3

I have Images like these from which I want to extract the Numbers.

enter image description here enter image description here

I've been working with OpenCV and Template Matching in particular Interested me, but as the technique doesn't account for any image scaling and rotation, I'm out looking for techniques that may be able to take atleast scaling into account.

Please offer any suggestion or help. All operation are in Real Time.

P.S. Image quality cannot be improved, The camera's capability is as such.

karlphillip
  • 92,053
  • 36
  • 243
  • 426
  • You can just resize/rotate the template/image and run the template matching again, to handle different scales and rotations. – fferen May 27 '12 at 18:51
  • fferen: Suggestion taken. I'd also like to get one thing clarified, I'm going through this process by having templates of the digits before hand. Then as the images come by I start matching with a predefined ROI. Is this whole process good ? Can it be bettered ?? –  May 27 '12 at 19:02
  • Yes, as long as you're sure the ROI will contain the digit. And also as it looks like the samples are different colors, make sure you account for that as well. – fferen May 27 '12 at 19:07
  • I'm converting everything to Binary Images, So the color is taken into account. Further more what if the fonts withing the image change ? I'll have to change my templates accordingly, shouldn't I ? Is this the only way out ? –  May 27 '12 at 19:10

2 Answers2

0

To detect these numbers without using SIFT or SURF it is also possible to create a classifier based on the K nearest Neighbour algorithm. You can generate a database of .pbm files and load them into a classifier using a c++ OCR library found here

Step by step:

1: Find a way to extract the numbers from the image using cvFindContours

2: Store these images as png files with cvSaveImage and convert them to binary pbm files

3: Number the .pbm files and store them in seperate folders for each number

4: Load the .pbm files with the library shown above

5: Use the function ocr::classify with the images in real time to get the category they belong to (e.g. which number).

Community
  • 1
  • 1
diip_thomas
  • 1,531
  • 13
  • 25
  • I will surely give it a try and report back within a couple of days. I did have a look at KNN, but will look deeper into it now. –  May 28 '12 at 15:15
  • I have somethings in CotourMatching that suits our application. I've been looking into Template Matching after Pre-Processing the Images. –  Jun 05 '12 at 17:34