0

I'm writing interesting application where I want to get numbers out of a runner t-shirt. I was playing around with AForge.NET and emguCV to get the desired result and I think I'm very close to solving my problem, but still I would like to get opinion from the more experience users. First I have this image:

enter image description here After that I apply it a max contrast and some lightening and I get this result:

enter image description here Next I binarize the image and get this final result: enter image description here [^]

Next I apply some basic filters to clear out the small blobs and the very big ones. Next I try to find blobs who have their height>width and after that I try to find similar blob sizes and shapes who are one next to another. This is my approach and in most of the situations works for me. As addition I create histogram of the possible blobs that I may consider as a letter. This means that I look for 2 dominant colors in that rectangle. If the two dominant colors are black(ish) or white(ish) than I know it is a number on the runners shirt. What I want to know, is there any different approach that you would do? Like mixing channels, converting to HSV space and maybe filtering black colors? My whole idea is to get those numbers with small amount of blobs that aren't numbers. I would appreciate any kind of suggestions. Comments and ideas are just fine, if you want to write code please do. Thank You...

Ahmed Ekri
  • 4,601
  • 3
  • 23
  • 42
  • As dr. mo suggested, dig into some textbooks and existing research before you go much farther. Buy or download a good standard text on image processing. A single binarization threshold may not work well in natural outdoor lighting with varying cloud cover. Working in black and white rather than grayscale may not work as well as expected. You may need to look into Stroke Width Transform. You might be inspired by OCR for license plate reading, but unlike license plates, runner's jerseys will not present flat numbers at all times; nonlinear deformation of characters will present a challenge. – Rethunk Sep 16 '13 at 17:22

3 Answers3

1

You need to carefully think about why you are doing those steps. what you are doing seems a bit random. it might work for one image but not for others. my suggestion:

  1. keep it as simple as possible
  2. work in grey scale or binary (discard colour early - it really has little information that is useful to you)
  3. be clear on what cases this needs to work for (inverted fonts, font size, rotations, backgrounds)
  4. have a training and test database of images you can evaluate you method on, so it's not just a subjective evaluation!
  5. there is a ton of literature on this subject already out there. i suggest you read it rather than reinventing the wheel!! you could spend years on this otherwise!
morishuz
  • 2,302
  • 4
  • 21
  • 21
  • 1
    +1 for the suggestion not to go "reinventing the wheel." OCR can be miserably difficult. It's surprising sometimes how much writing a clear and reasonable specification--if only for oneself--can help delimit the problem. Good luck to Vanco Pavlevski. – Rethunk Sep 16 '13 at 17:15
  • thank you guys for writing me back. This question was posted to couple of forums and I didn't get any answer at all. This is very interested area, and I actually get good results with what I'm doing right now. When I do find the Histogram and the two dominant colors in the possible "letter"-blob (and I'm looking at blackish and white colors) I have almost 90% (even more) accuracy that I'm having letter in that particular rectangle. Now it's time to do the OCR. And here I have another problems of letters who are rotated, or noised by sun reflection OR if there is an arm in front of them. –  Sep 16 '13 at 17:56
0

looking at the features of the image, you might first detect squares, since text is in a white block. Not sure if aforge can detect squares but other libraries might be able to do so.

user613326
  • 2,140
  • 9
  • 34
  • 63
0

Great question, there are a number of ways to do this. I reccomend you to read this : Image Processing: Algorithm Improvement for 'Coca-Cola Can' Recognition

Ok your going for text, i think i would start with finding white squares next use some OCR to detect numbers (openCV) or train your own neural network for it. Or perhaps rate each number blacknes (maybe over its top and lower area) so you can distinguish a 6 from a 9.

Community
  • 1
  • 1
Peter
  • 2,043
  • 1
  • 21
  • 45