如何在flutter中检测图像中的文本

问题描述 投票:0回答:1

我们构建《古兰经》颤动应用程序,我们需要从图像中检测单词和句子,因为很难将其构建为文本,也很难成为图像,因为我们需要用户单击任何文本并显示对话框。

我们需要构建像应用程序这样的功能,它的名字是Surah。 enter image description here

我们尝试使应用程序基于文本,但格式很困难且响应不佳

flutter image-processing ocr object-detection
1个回答
0
投票

使用 firebase_ocr 包中的 FirebaseOcr 类从图像中提取文本。

String extractTextFromImage(String imagePath) {
 try {
      final FirebaseOcr firebaseOcr = FirebaseOcr();
      final List<String> extractedText = 
      firebaseOcr.extractTextFromImage(imagePath);
      return extractedText.join(' '); // Join the text into a single string
     } catch (e) {
           print('Error extracting text: $e');
           return '';
    }
   }
© www.soinside.com 2019 - 2024. All rights reserved.