Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pytesseract does not recognize when it's just a letter

I need to recognize only one letter

But OCR does not recognize when it's just a letter

in this case I am trying to recognize the letter H but nothing shows up

What can I do to make it work?

from PIL import Image
from pytesseract import *
import cv2
img = cv2.imread('H.png',0)
edges = cv2.Canny(img,100,200)
img_new = Image.fromarray(edges)
text = pytesseract.image_to_string(img_new, lang='eng')
print (text)
like image 469
Bernardo Martins Avatar asked Nov 15 '25 17:11

Bernardo Martins


1 Answers

Try the following:

    text = pytesseract.image_to_string(img_new, lang='eng', config='--psm 10')
like image 127
QuarKUS7 Avatar answered Nov 18 '25 08:11

QuarKUS7



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!