Trouble recognizing digits in Tesseract - android

前端 未结 3 1326
面向向阳花
面向向阳花 2021-02-04 15:21

I was hoping someone could tell me why it is my Tesseract has trouble recognizing some images with digits, and if there is something i can do about it. Everything is working acc

相关标签:
3条回答
  • 2021-02-04 15:50

    Tesseract doesn't do segmentation for you. Tesseract will do a thresholding of the image prior to the actual tesseract algo. After thresholding, there may be some edges, artefacts that remain in the image.

    Try to manually modify your images to black and white colors and see what tesseract returns as output.

    Try to threshold (automatically) your images and see what tesseract returns as output. The output of thresholding may be too bad causing tesseract to give bad output.

    Your 4th image will probably fail due to thresholding (you have 3 colors: black background, greyish background and white letters) and the threshold may be between (black background, greyish background).

    Generally Tesseract wants nice black and white images. Preprocessing of your images may be needed for better results.

    For your first image (with the result "04"), try to see the box result (char + coordinates of box that contains the recognized char). The "0" may be a small artefact - like a 4 by 4 blob of pixels.

    0 讨论(0)
  • 2021-02-04 15:52

    You may give javaocr a try ( http://sourceforge.net/projects/javaocr/ , yes, I'm developer )

    Therre is no offocial release though, and you will have to look for sources ( good news: there is working android sample including sampler, offline trainer and recognizer application )

    If you only one font, you can get pretty good results with it (I reached up to recognition rates 99.96 on digits of the same font)

    PS: it is pure java and uses invariant moments to perform matching ( so no problems with scaling and rotation ) . There is also pretty effective binarisation.

    See it in action:

    https://play.google.com/store/apps/details?id=de.pribluda.android.ocrcall&feature=search_result#?t=W251bGwsMSwxLDEsImRlLnByaWJsdWRhLmFuZHJvaWQub2NyY2FsbCJd

    0 讨论(0)
  • 2021-02-04 16:06

    I know of some options that might help you:

    1. Add extra space between image border and text. Tesseract would work awful if text in the image is positioned at the edge.
    2. Duplicate your image. For example, if you're performing OCR on a word 'foobar', clone the image and send 'foobar foobar foobar foobar foobar' to tesseract, results would be better.
    3. Google for font training and image binarization for tesseract.

    Keep in mind, that built-in camera in mobile devices mostly produce low quality images (blured, noised, skewed etc.) OCR itself is a resource comsuming process and if you add a worthy image preprocessing to that, low-end and mid mobile devices (which are likely to have android) could face unexpectedly slow performance or even lack of resources. That's OK for free/study projects, but if you're planning a commercial app - consider using a better SDK.

    Have a look at this question for details: OCR for android

    0 讨论(0)
提交回复
热议问题