10

I want to do OCR on this image.enter image description here This is pre-define format. ie first five will characters, then next four will be digits and last will be character.

When I execute following command

$ tesseract in.png stdout

I get output as BDVPD474SQ

So, I went for user-pattern. I created a file(in directory /usr/share/tesseract-ocr/tessdata/configs) named as bazaar (its content is as follow)

load_system_dawg     F
load_freq_dawg       F
user_patterns_suffix user-patterns

I also created a file, named as eng.user-patterns in directory /usr/share/tesseract-ocr/tessdata (its content is as follow)

\A\A\A\A\A\d\d\d\d\A

Still, I am getting same result

$ tesseract in.png stdout bazaar
BDVPD474SQ

What I am doing wrong ? Has anyone accomplished this by Tess4j ?

4
  • I had to delete my post, since it was obviously wrong. I looked at the source ( code.google.com/p/tesseract-ocr/source/browse/dict/trie.h ), which proves your pattern correct. Also I tried your example and got the same result.
    – Jo Oko
    Nov 5, 2015 at 9:22
  • 2
    @JoOko So can we say that, this feature is not implemented ?
    – Bhushan
    Nov 5, 2015 at 10:15
  • 3
    And still seems to be the case all these years later? :\
    – jtlz2
    Sep 12, 2019 at 7:14
  • still facing same issue, there isn't much on how to use it Oct 8, 2022 at 16:56

1 Answer 1

0

You can add the option --oem 0 to ensure user patterns apply. See this PR comment.

Since I am on tesseract 5.3.3, I had to tweak your input image to reproduce a similar behavior:

enter image description here

I specify the user pattern \A\A\A\A\A\d\d\d\A\A, to force recognition of the partially erased 9 character as a letter.

With --oem 0, Tesseract returns BDVPD474SQ (it reads an S).

Without the option, Tesseract returns BDVPD474SQ (identifying a 5).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.