0

I have an image like the following:

Image to be processed

and I would want to extract the text from it, that should be ws35, I've tried with pytesseract library using the method :

pytesseract.image_to_string(Image.open(path))

but it returns nothing... Am I doing something wrong? How can I get back the text using the OCR ? Do I need to apply some filter on it ?

aleroot
  • 68,849
  • 28
  • 172
  • 209

4 Answers4

5

You can try the following approach:

  • Binarize the image with a method of your choice (Thresholding with 127 seems to be sufficient in this case)
  • Use a minimum filter to connect the lose dots to form characters. Thereby, a filter with r=4 seems to work quite good: Image after application of minimum filter
  • If necessary the result can be further improved via application of a median blur (r=4): enter image description here

Because i personally do not use tesseract i am not able to try this picture, but online ocr tools seem to be able to identify the sequence correctly (especially if you use the blurred version).

SilverMonkey
  • 973
  • 6
  • 16
1

Similar to @SilverMonkey's suggestion: Gaussian blur followed by Otsu thresholding.

enter image description here

Yves Daoust
  • 53,540
  • 8
  • 41
  • 94
0

The problem is that this picture is low quality and very noisy! even proffesional and enterprisal programs are struggling with this

you have most likely seen a capatcha before and the reason for those is because its sent back to a database with your answer and the image and then used to train computers to read images like these.

short answer is: pytesseract cant read the text inside this image and most likely no module or proffesional programs can read it either.

Stanley
  • 2,043
  • 14
  • 23
0

You may need apply some image processing/enhancement on it. Look at this post read suggestions and try to apply.

user70
  • 539
  • 2
  • 7
  • 21