0

I'm trying to extract some contents from a cropped image. I tried pytesseract and opencv template matching but the results are very poor. OpenCV template matching sometimes fails due to poor quality of the icons and tesseract gives me a line of text with false characters.

I'm trying to grab the values like this:

0:26 83 1 1

Any thoughts or techniques?

enter image description here

roosevelt
  • 1,874
  • 4
  • 20
  • 27

1 Answers1

1

A technique you could use would be to blur your image. From what it looks like, the image is kind of low res and blurry already, so you wouldn't need to blur the image super hard. Whenever I need to use a blur function in Opencv, I normally choose the gaussian blur, as its technique of blurring each pixel as well as each surrounding pixel is great. Once the image is blurred, I would threshold, or adaptive threshold the image. Once you have gotten this far, the image that should be shown should be mostly hard lines with little bits of short lines mixed between. Afterwards, dilate the threshold image just enough to have the bits where there are a lot of hard edges connect. Once a dilate has been performed, find the contours of that image, and sort based on their height with the image. Since I assume the position of those numbers wont change, you will only have to sort your contours based on the height of the image. Afterwards, once you have sorted your contours, just create bounding boxes over them, and read the text from there.

However, if you want to do this the quick and dirty way, you can always just manually create your own ROI's around each area you want to read and do it that way.

First Method

  1. Gaussian blur the image
  2. Threshold the image
  3. Dilate the image
  4. Find Contours
  5. Sort Contours based on height
  6. Create bounding boxes around relevent contours

Second Method

  1. Manually create ROI's around the area you want to read text from
Aaron Jones
  • 1,140
  • 1
  • 9
  • 26