Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- image = cv2.imread(args["image"])
- gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
- gray = cv2.resize(gray, None, fx=2, fy=2, interpolation=cv2.INTER_CUBIC)
- if args["preprocess"] == "thresh":
- gray = cv2.threshold(gray, 0, 255,
- cv2.THRESH_BINARY | cv2.THRESH_OTSU)[1]
- elif args["preprocess"] == "blur":
- gray = cv2.medianBlur(gray, 3)
- filename = "Screens/{}.png".format(os.getpid())
- cv2.imwrite(filename, gray)
- text = pytesseract.image_to_string(Image.open(filename), lang='vie')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement