OCR。使用tesseract识别里程表

时间:2022-03-01 23:33:15

I want to recognize digits from odometer. I found this tutorial for iOS. https://www.raywenderlich.com/93276/implementing-tesseract-ocr-ios

我想识别里程表的数字。我找到了iOS的这个教程。 https://www.raywenderlich.com/93276/implementing-tesseract-ocr-ios

my tesseract properties:

我的tesseract属性:

func performImageRecognition(image: UIImage) {

    let tesseract = G8Tesseract()
    tesseract.language = "eng"
    tesseract.engineMode = .TesseractCubeCombined
    tesseract.pageSegmentationMode = .Auto
    tesseract.maximumRecognitionTime = 60.0
    tesseract.setVariableValue("0123456789", forKey: "tessedit_char_whitelist")
    tesseract.image = image.g8_blackAndWhite()
    tesseract.recognize()
  }

The app successfully recognizes a standard text. But app cant to recognize digits from odometer. It is possible to adapt a tesseract for scanning of the odometer?

该应用程序成功识别标准文本。但应用程序无法识别里程表的数字。可以使用tesseract来测量里程表的扫描吗?

I tried this images: OCR。使用tesseract识别里程表 OCR。使用tesseract识别里程表 OCR。使用tesseract识别里程表

我试过这个图片:

2 个解决方案

#1


3  

If I were you I would try to cut out the numbers from the odometer image, straighten them, do threshold (everything manually) and see whether tesseract scans processed image properly, how clear the results are. If it does scan properly, you should make algorythm to process images programatically (with openCV probably would be best). If it does not, you should try to train your tesseract for these numbers, common on the odometers, and then see how tesseract works (I have not tried training personally, maybe this will help).

如果我是你,我会尝试从里程表图像中删除数字,拉直它们,做阈值(手动一切)并查看tesseract是否正确扫描处理过的图像,结果有多清楚。如果它确实正确扫描,你应该使algorythm以编程方式处理图像(openCV可能是最好的)。如果没有,你应该尝试训练你的tesseract这些数字,在里程表上常见,然后看看tesseract如何工作(我没有尝试过个人训练,也许这会有所帮助)。

OCR。使用tesseract识别里程表

Your image should look like this, but the thing is, that for example, the last number for sure will not be recognised as 1, even despite you reduce your tesseract character whitelist to "0123456789", it will be scanned as 1 and 1 (because of two parts). I think that tesseract training is mandatory in your situation if you want to use tesseract. By the way, situation with your previous two images should be better.

您的图像应如下所示,但事实是,例如,即使您将tesseract字符白名单减少为“0123456789”,最后确定的数字也不会被识别为1,它将被扫描为1和1(因为两部分)。如果您想使用tesseract,我认为在您的情况下,tesseract培训是强制性的。顺便说一下,你前两张图片的情况应该会更好。

#2


2  

OCR for Seven-segment display numbers in objective C.

OCR用于目标C中的七段显示数字。

#1


3  

If I were you I would try to cut out the numbers from the odometer image, straighten them, do threshold (everything manually) and see whether tesseract scans processed image properly, how clear the results are. If it does scan properly, you should make algorythm to process images programatically (with openCV probably would be best). If it does not, you should try to train your tesseract for these numbers, common on the odometers, and then see how tesseract works (I have not tried training personally, maybe this will help).

如果我是你,我会尝试从里程表图像中删除数字,拉直它们,做阈值(手动一切)并查看tesseract是否正确扫描处理过的图像,结果有多清楚。如果它确实正确扫描,你应该使algorythm以编程方式处理图像(openCV可能是最好的)。如果没有,你应该尝试训练你的tesseract这些数字,在里程表上常见,然后看看tesseract如何工作(我没有尝试过个人训练,也许这会有所帮助)。

OCR。使用tesseract识别里程表

Your image should look like this, but the thing is, that for example, the last number for sure will not be recognised as 1, even despite you reduce your tesseract character whitelist to "0123456789", it will be scanned as 1 and 1 (because of two parts). I think that tesseract training is mandatory in your situation if you want to use tesseract. By the way, situation with your previous two images should be better.

您的图像应如下所示,但事实是,例如,即使您将tesseract字符白名单减少为“0123456789”,最后确定的数字也不会被识别为1,它将被扫描为1和1(因为两部分)。如果您想使用tesseract,我认为在您的情况下,tesseract培训是强制性的。顺便说一下,你前两张图片的情况应该会更好。

#2


2  

OCR for Seven-segment display numbers in objective C.

OCR用于目标C中的七段显示数字。