我在 python 中使用pytesseract模块,pytesseract可以识别图像中的文本,但它不适用于包含复杂数学公式(如根、推导、积分数学问题或方程)的图像。
\n\n代码2.py
\n\n# Import modules\nfrom PIL import Image\nimport pytesseract\nimport cv2\n\n# Include tesseract executable in your path\npytesseract.pytesseract.tesseract_cmd = r"C:\\Program Files\\Tesseract-OCR\\tesseract.exe"\n\n# Create an image object of PIL library\nimage = Image.open(\'23.jpg\')\n\n# img = cv2.imread(\'123.jpg\')\n# pass image into pytesseract module\n\n# pytesseract is trained in many languages\nimage_to_text = pytesseract.image_to_string(image, lang=\'eng+equ\')\n\nimage_to_text1 = pytesseract.image_to_string(image)\n\n# Print the text\nprint(image_to_text)\n# print(image_to_text1)\n\n\n# workon digits\nRun Code Online (Sandbox Code Playgroud)\n\n输出:
\n\n242/33\n2x\n\n2x+3X\n\n2X+3x=4\n\n2x?-3x +1=0\n(x-1)(x+1) =x2-1\n(x+2)/((x+3)(x-4))\n\n7-4=3\nV(x/2) =3\n\n2xx\xe2\x80\x94343=6x\xe2\x80\x943 (x#3)\n\nJeeta =e* +e\n\ndy 2\nS=2?-3\ndz \xc2\xa5\n\ndy = (a? \xe2\x80\x94 3)dx\nRun Code Online (Sandbox Code Playgroud)\n\n …