Tesseract无法从简单图像中识别数字
这是图像,我正在尝试提取“ 3158”
导入CV2 导入Tesseract img = cv2.imread('cropped.png') convert_to_string = pytesseract.image_to_string(img) 打印(convert_to_string)
但不幸的是,它没有打印
我尝试过的
pytesseract.image_to_string(img,config=' --psm 1 --oem 3)
任何东西,
pytesseract.image_to_string(img,config=' --psm 6)
但仍然没有运气
This is the image and I'm trying to extract "3158"
And this is the code
import cv2 import tesseract img = cv2.imread('cropped.png') convert_to_string = pytesseract.image_to_string(img) print (convert_to_string)
But unfortunately it failed to print anything
I've tried
pytesseract.image_to_string(img,config=' --psm 1 --oem 3)
and
pytesseract.image_to_string(img,config=' --psm 6)
But still no luck
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试首先对图像进行二进制,如果字体在背景中没有清晰脱颖而出,则Tesseract无法正常工作。由于背景中有梯度,因此您可能会通过自适应阈值预处理获得一些优秀结果:
Try to binarize the image first, Tesseract does not work well if the font does not stand out clearly from the background. Since there's a gradient in the background, you may get some first good results with adaptive thresholding preprocessing: