Ask Your Question

How to recognize numbers in the tickets using OpenCV?

asked 2017-07-04 21:39:45 -0500

How to locate and recognize the red numbers (A018132, F05691, M052659 for blues tickets; 374080144, C063497, P082400 for red tickets) in the following tickets using OpenCV?

Maybe the difficult part should be text localisation and seperation. If possible please provide some sample code that I can learn and test. Thanks in advance!

Blue tickets Red tickets

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2017-07-05 05:00:56 -0500

rhardih gravatar image

In the case of the tickets with a QR code preset, it seems the numbers you are interested in are in a fixed position relative the the QR code. I would start by locating said QR code in the image, as that is probably the easiest task and then proceed to find the numbers relative to that.

Here's an example of how to find a QR code:

The next part is to then determine a set of coordinate ranges corresponding to the location of the numbers in your tickets. Using the list of contours you already found in locating the QR code, you should now be able to stepwise filter-out found contours that fall outside of these specified ranges.

Once you have found the location of each number, cut out a region of interest from each area and then send those onto whatever OCR engine you've decided to use. OpenCV comes with an api wrapper for Tesseract, if you've compiled in support for it.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2017-07-04 21:39:45 -0500

Seen: 225 times

Last updated: Jul 05 '17