import pytesseract import cv2 img = cv2.imread("captcha.jpg",0) try: img.shape except AttributeError: pass else: code = pytesseract.image_to_string(img) print(code)
接口就是pytesseract.image_to_string(),前提就是需要安装tesseract-OCR,并加入环境变量。
import pytesseract import cv2 img = cv2.imread("captcha.jpg",0) try: img.shape except AttributeError: pass else: code = pytesseract.image_to_string(img) print(code)
接口就是pytesseract.image_to_string(),前提就是需要安装tesseract-OCR,并加入环境变量。