Jump to content

OCR & rotated numbers (1 & 2 digits)


Recommended Posts

Do your images always look like this?

I'd experiment with using the white circles to center your frame of reference. Once you have your coordinates set, I'd do a quick binary threshold on the central area where the numbers are, and use some binary morphology to fill the cavities inside your digits.

I'd first try the IMAQ Fill Holes.vi (I think it's called something like that). Alternatively, you can try dilate/erode combination, which may work better here in the even the numbers don't fully enclose the cavities every time.

Once you have done that the OCR might work better. There are quite a lot of other tools you can play with to sharpen up your image. I'm not sure how well the OCR algorithms perform if the number is printed at an arbitrary angle. I've never tried that, so I'm interested to see.

 

Alternatively, if your digits are always the same you could try making 10 templates (0-9) and using the IMAQ object/pattern matching VIs which are rotationally invariant. Would be a bit more work for you on the back end to figure out the ordering of the digits though

Edited by caleyjag
Link to comment
  • 3 weeks later...

Thanks caleyjag. I got the code to work nicely after using your suggestions. It all boiled down to really cleaning up the image and training. The image needed to be rotated until the confidence level was met. i.e. the OCR was trained in a consistent way. Subtleties such a slight twist or how light/dark the value was required manual intervention with a lot of samples. The final result was >98% accuracy across 6.5k images.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.