phnmnn
phnmnn

Reputation: 13250

OCR. Using tesseract to recognize odometer

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

my tesseract properties:

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?

I tried this images: enter image description here enter image description here enter image description here

Upvotes: 2

Views: 1838

Answers (2)

Dainius Šaltenis
Dainius Šaltenis

Reputation: 1734

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).

enter image description here

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.

Upvotes: 3

Related Questions