Reshika
Reshika

Reputation: 15

Digit Recognition with Tesseract python

For one of the projects I am working on, I am trying to detect digits on a food tray image using OCR. I used Tesseract 4 in python for this purpose. But it fails to correctly detect the numbers for most of the images I have. I tried various image preprocessing such as blurring, threshold, sharpening, erosion and dilation using OpenCV to improve the accuracy. But nothing seems to work. I am newbie to computer vision, so any suggestions or alternate solutions for this would be of great help. I have attached the images in the link below. thanks in advance.

Link to Images

Upvotes: 1

Views: 1464

Answers (1)

Vu Gia Truong
Vu Gia Truong

Reputation: 1032

You need a stronger text detection which will crop the text-candidate region for you.

The processing will be a little more complicated as follow:

  1. Run text detection, get the text-candidated region
  2. Extract that region
  3. Use tesseract to read the text

Inside OpenCV's DNN modules have the great text detection script called : text_detection.py which is used EAST text detection. Using your sample images, i can extract the following text-candidate region in green rectangle. So the next steps is the above step 2 and 3.

enter image description here

enter image description here

For sure, EAST is not trained for your scenario so 100% accuracy is impossible. You could try to gather data and train EAST for your scenario. But i think, the default one will give you more than 90% in accuracy.

Hope this help.

Upvotes: 2

Related Questions