4

I am having the following image and trying to extract the text using pytesseract. But, it always returns some unknown character.
Image

 image

This is the code I am using:

import pytesseract as pt
from PIL import Image

#Converting image to text
img = Image.open('frame-1ROI_2.png')
extracted = pt.image_to_string(img)
print(extracted)
print(type(extracted)) 

This is the output

output

If I use this online text extraction tool, it does extract the text and returns the correct text.

Update 1

I have made this code change and the result is still the same.

img = img.convert("L")
img = img.filter(ImageFilter.SMOOTH_MORE)

The image now looks like this:

enter image description here

I have also tried this method but the output is still the same.

JAMSHAID
  • 1,258
  • 9
  • 32

0 Answers0