-1

I am a beginner in OpenCV, and am trying to extract numbers from a dataset of images and use the extracted numbers as a dataset for NN. For this, I'm using mser's bounding boxes and then cropping the image in size of the bounding box. but mser is not detecting the text area correctly. Please help me on how to do it more precisely. here is my code:

mser = cv2.MSER_create(_delta = 1)

msers, bbs = mser.detectRegions(gray)

Here bbs are the list of bounding boxes, they are not on the text area, not even one.

enter image description here

Image of the ground truth, where the bounding box should be:

enter image description here

Bounding box by mser:

enter image description here

Another example of the bounding box by mser:

enter image description here

stateMachine
  • 5,227
  • 4
  • 13
  • 29
  • If you want to just detect the text, [EAST](https://www.pyimagesearch.com/2018/08/20/opencv-text-detection-east-text-detector/) can be a solution. If you also want to detect characters, have a look at the [tesseract](https://www.pyimagesearch.com/2018/09/17/opencv-ocr-and-text-recognition-with-tesseract/) – Yunus Temurlenk Mar 18 '20 at 07:03

1 Answers1

0

If you want to detect text on an image, I use Tesseract to accomplish this. You just link it a tessdata file to the language you are using, and it should detect the text in the image and output it as a string. However, if you want to crop the original image further before you detect text on an image, you could use blob detection. Blob detection is where an image is passed through a variety of different image thresholds, and it looks for consistency, and if consistency is found, a blob is created at that region. You could use blob detection in this situation, then create your bounding rectangles off of those blobs.

Aaron Jones
  • 1,140
  • 1
  • 9
  • 26