【发布时间】:2020-07-20 16:20:40
【问题描述】:
我在 python 中使用 pytesseract 模块,pytesseract 可以识别图像中的文本,但它不适用于包含复杂数学公式的图像,例如根目录下, 推导, 积分数学问题或方程。
代码 2.py
# Import modules
from PIL import Image
import pytesseract
import cv2
# Include tesseract executable in your path
pytesseract.pytesseract.tesseract_cmd = r"C:\Program Files\Tesseract-OCR\tesseract.exe"
# Create an image object of PIL library
image = Image.open('23.jpg')
# img = cv2.imread('123.jpg')
# pass image into pytesseract module
# pytesseract is trained in many languages
image_to_text = pytesseract.image_to_string(image, lang='eng+equ')
image_to_text1 = pytesseract.image_to_string(image)
# Print the text
print(image_to_text)
# print(image_to_text1)
# workon digits
输出:
242/33
2x
2x+3X
2X+3x=4
2x?-3x +1=0
(x-1)(x+1) =x2-1
(x+2)/((x+3)(x-4))
7-4=3
V(x/2) =3
2xx—343=6x—3 (x#3)
Jeeta =e* +e
dy 2
S=2?-3
dz ¥
dy = (a? — 3)dx
【问题讨论】:
-
请添加一些示例图片和一些示例代码。
-
这是tesseract 的包装器。一旦你已经安装了它,你有没有在 cli 中尝试过?无论如何,这是很常见的情况,ORC 工具无法识别所有内容。
-
@Sameer 我附上了我的代码和输出,一些数学方程无法正确检测。我能做些什么?提前谢谢你。
-
@yvs 链接无效,先生。
-
@SumitPatel 对不起,使用这个:github.com/tesseract-ocr/tesseract
标签: python-3.x algorithm image-processing