python - tesseract:如何使用用户词 python
问题描述
我在我的 python 应用程序中使用 Tesseract,我只会使用我自己的字典。
我试图用集市解释来做,但我不明白该怎么做?!
我没有找到执行此操作的 python 命令,这是我的代码:
import cv2
import pytesseract as tess
tess.pytesseract.tesseract_cmd = r'C:\Users\Utilisateur\AppData\Local\Programs\Tesseract-OCR\tesseract.exe'
def ocr(img):
cv2.imwrite('image.png', img)
img = cv2.medianBlur(img, 1)
img = cv2.adaptiveThreshold(img, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, \
cv2.THRESH_BINARY, 31, 20)
cv2.imshow('frames', img)
text = tess.image_to_string(img , lang='fra+eng') #config='bazaar'
print(text)
vid = cv2.VideoCapture(0)
while (True):
ret, frame = vid.read()
cv2.imshow('frame', frame)
if cv2.waitKey(1) % 256 == 32:
ocr(frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
vid.release()
cv2.destroyAllWindows()
谁能一步一步地向我解释如何只使用我的话?或者也许修改训练有素的文件?
解决方案
推荐阅读
- angular - 如何在 Angular 中访问子组件对象
- angular - 是否可以在不触发反应表单控件上的 valueChanges 的情况下触发 statusChanges?
- c++ - 为什么迭代 std::set 比迭代 std::vector 慢得多?
- emacs - 如何在 Emacs 中为我的自定义 comint 模式添加自动完成功能?
- c# - 在.Net控制台应用程序中将数据写入请求流期间是否可以监听来自HTTP服务器的响应?
- android - 试图理解 Bitmap.Config.ARBG_8888
- git - 多个 git 配置文件
- python-2.7 - Chromedriver 因“无法识别的功能:chromeOptions”而崩溃
- php - PHP parse_str 输出无效字符
- awk - 使用 awk 比较 2 个文件,如果匹配则打印