Guest User

Untitled

a guest
Jul 19th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. enter code here
  2.  
  3. import cv2
  4. import pytesseract
  5. from PIL import Image
  6. img = cv2.imread('170.png')
  7. gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
  8. # gray = cv2.threshold(gray, 0, 255, cv2.THRESH_BINARY |
  9. cv2.THRESH_OTSU)[1]
  10. ret,gray = cv2.threshold(gray,110,255,cv2.THRESH_BINARY)
  11. cv2.imshow("threshold", gray)
  12. cv2.waitKey(0)
  13. cv2.destroyAllWindows()
  14. # gray = cv2.medianBlur(gray, 3)
  15. text = pytesseract.image_to_string(gray)
  16. print(text)
Add Comment
Please, Sign In to add comment