Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/107.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iOS-如何使用tesseract OCR将文本识别为块_Ios_Swift_Ocr_Tesseract_Text Recognition - Fatal编程技术网

iOS-如何使用tesseract OCR将文本识别为块

iOS-如何使用tesseract OCR将文本识别为块,ios,swift,ocr,tesseract,text-recognition,Ios,Swift,Ocr,Tesseract,Text Recognition,我正在使用谷歌的tesseract OCR()在我的iOS应用程序中执行图像到文本的转换 我能够使用以下代码扫描并获取字符串 let tesseract:G8Tesseract = G8Tesseract(language:"eng") tesseract.delegate = self tesseract.image = imageTaken // image taken from camera tesseract.engineMode = .t

我正在使用谷歌的tesseract OCR()在我的iOS应用程序中执行图像到文本的转换

我能够使用以下代码扫描并获取字符串

let tesseract:G8Tesseract = G8Tesseract(language:"eng")
        tesseract.delegate = self
        tesseract.image = imageTaken // image taken from camera
        tesseract.engineMode = .tesseractCubeCombined  
        tesseract.recognize()  
        print(tesseract.recognizedText)
它以逐行方式扫描和检索文本。(混合其他段落中的行)。像这样

图像1

现在,我如何把文本作为一个块,并分别从每个块中读取行。像这样

图像2

我尝试过的事情。

  • 打印(tesseract.recognizedBlocks(by:.块))
  • 打印(tesseract.recognizedBlocks(按:。段落))
尽管如此,它还是混合了不同段落中的行,并将文本视为一行,如图1所示

任何帮助都将不胜感激。提前谢谢