Issue
I need to extract digits from images (see sample images). I tried pytesseract
but it is not working, it produces empty results. Below is the code I am using
Code
import pytesseract
import cv2
img = cv2.imread('image_path')
digits = pytesseract.image_to_string(img)
print(digits)
Sample Images
I have a large pool of images, as shown above. Tesseract
is not working on any of them.
Solution
Try adding config --psm 7
(meaning Treat the image as a single text line.
)
import pytesseract
import cv2
img = cv2.imread('image_path')
digits = pytesseract.image_to_string(img,config='--psm 7')
print(digits)
#'971101004900 1545'
Answered By - ExplodingGayFish
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.