Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- enter code here
- import cv2
- import pytesseract
- from PIL import Image
- img = cv2.imread('170.png')
- gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
- # gray = cv2.threshold(gray, 0, 255, cv2.THRESH_BINARY |
- cv2.THRESH_OTSU)[1]
- ret,gray = cv2.threshold(gray,110,255,cv2.THRESH_BINARY)
- cv2.imshow("threshold", gray)
- cv2.waitKey(0)
- cv2.destroyAllWindows()
- # gray = cv2.medianBlur(gray, 3)
- text = pytesseract.image_to_string(gray)
- print(text)
Add Comment
Please, Sign In to add comment