OpenCV Tesseract

OpenCV Tesseract

本文关键字:Tesseract OpenCV      更新时间:2023-10-16

我试着运行这段代码https://github.com/Itseez/opencv_contrib/blob/master/modules/text/samples/end_to_end_recognition.cpp

作为c++(VS12)中的项目,但我得到了这个

TIME_REGION_DETECTION = 21744.2
TIME_GROUPING = 1187.99
OCRTesseract(33): Tesseract not found.
TIME_OCR_INITIALIZATION = 2.85173
OCRTesseract(00): Tesseract not found.
OCR output = "" lenght = 0
OCRTesseract(00): Tesseract not found.
OCR output = "" lenght = 0
OCRTesseract(00): Tesseract not found.
OCR output = "" lenght = 0
OCRTesseract(00): Tesseract not found.
OCR output = "" lenght = 0
OCRTesseract(00): Tesseract not found.
OCR output = "" lenght = 0
TIME_OCR = 42.6972

这是因为您在构建OpenCV后安装tessaract,所以在尝试使用CMake生成项目文件时,应确保OpenCV找到Tesaract。

1-安装第一个Tessact:

此链接可能会有所帮助:http://emop.tamu.edu/Installing-Tesseract-Windows8

2-当尝试使用CMake生成visual studio时,您应该确保CMake找到Tessact:

事实上,如果它没有找到,标志HAVE_TESSERACT将不会被定义,因此库opencv_text300.dll将在您尝试访问Tessart引擎时生成此消息OCRTesseract(33): Tesseract not found.。你可以在这里看到行为:https://github.com/Itseez/opencv_contrib/blob/master/modules/text/src/ocr_tesseract.cpp#L142

3-生成使用HAVE_TESSERACT生成的正确opencv_text300.dll

4-执行您的可执行文件,使程序正确运行