Training Tesseract 3 to recognize numbers from real images of gas meters

后端 未结 4 588
有刺的猬
有刺的猬 2021-02-08 18:39

I\'m trying to train tesseract to recognize numbers from real images of gas meters.

The images that I use for training are made with a camera, for this reason there are

4条回答
  •  梦毁少年i
    2021-02-08 19:28

    Tesseract is a pretty decent OCR package, but doesn't pre-process images properly. My experience is that you can get a good OCR result if you just do some pre-processing before passing it on to tesseract.

    There are a couple of key pointers that improves recognition significantly:

    1. Remove background noise. Basically this means using mean adaptive thresholding. I'd also ensure that the characters are black and the background is white.
    2. Use the correct resolution. If you get bad results, scale the image up or down until you get good results. You want to aim at approx. font size 14 at 300 dpi; in my software that processes invoices that works best.
    3. Don't store images as JPEG; use BMP or PNG or something else that doesn't make the image noisy.
    4. If you're only using one or two fonts, try training tesseract on these fonts.

    As for point 4, if you know the font that's going to be used, there are some better solutions than using Tesseract like matching these fonts directly on the images... The basic algoritm is to find the digits and match them to all possible characters (which are only 10)... still, the implementation is tricky.

提交回复
热议问题