Issue
I need to OCR this clock. However, pytesseract isn't returning any result. Could someone help me out?
This is the code I have:
screen_gray = cv2.cvtColor(screen_crop, cv2.COLOR_BGR2GRAY)
screen_thresh = cv2.threshold(screen_gray, 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU)[1]
screen_thresh = cv2.threshold(screen_gray, 0, 255, cv2.THRESH_BINARY_INV + cv2.THRESH_OTSU)[1]
screen_noise = cv2.medianBlur(screen_thresh, 1)
This is the image processing result:
Solution
You don't need any OCR for that. You have 10 different digits, so you can easily create the mask for every digit. The placement of the digits is fixed, so you have to apply 10 masks to 5 different places and two masks to the leading place, and then see which mask fits the best.
By "applying the mask" I'd propose you XOR the mask and the binarized region from the image and count how many pixels do not match. Choose the mask with the minimum amount of "non-matching" pixels.
Answered By - lenik
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.