Issue
I've been trying to get some numbers from this image but pytesseract only gives me random letters. I've tried many -psm options but it does not seem to work. Here's the code I'm using:
from PIL import Image
import pytesseract
print(pytesseract.image_to_string(Image.open("Test.png"), config="--psm 6"))
What could I do to make it more succesful?
Solution
Try this code.
import cv2
import pytesseract
img = cv2.imread("vuK1z.png", 0)
thresh = cv2.threshold(img, 127, 255, cv2.THRESH_BINARY_INV)[1]
custom_config = r'-l eng --oem 3 --psm 6 '
text = pytesseract.image_to_string(thresh, config=custom_config)
print(text)
Result
550,000
Answered By - us2018
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.