Problem with OcrTesseract class.

asked 2016-08-19 10:03:29 -0500

noyanc gravatar image

updated 2016-08-19 12:02:38 -0500

LBerger gravatar image

Hello everyone,

I hope you are all well. I have installed opencv with extra modules with help of this [] tutorial. During configuration stage I have a message which says "Tesseract: NO"

After installation I have created a simple scene text detection project. And I have succesfully detected text in images.

After this part, I have tried to run ocr with below code.

// img1 is a CV_8UC3 typed mat image. and output is a string variable.

Ptr<OCRTesseract> ocr = OCRTesseract::create();
ocr->run(img1, output);

This piece of code runs without any error but does not give me any ocr result. I have tried different images but result is the same.

I have also tried to set parameters for create function.

Ptr<OCRTesseract> ocr = OCRTesseract::create("C:\\Program Files (x86)\\Tesseract-OCR\\tessdata", "eng", "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");

Unfortunatelly this did not went well too. I did not get any errors but did not get a result too.

How can I make my code work?

Thanks in advance.

Here is full log generated after I hit configure button in CMAKE.

FP16: Compiler support is available
found IPP (ICV version): 9.0.1 [9.0.1]
at: C:/opencv-3.0/source/opencv/3rdparty/ippicv/unpack/ippicv_win
Could NOT find Doxygen (missing:  DOXYGEN_EXECUTABLE) 
To enable PlantUML support, set PLANTUML_JAR environment variable or pass -DPLANTUML_JAR=<filepath> option to cmake
Could NOT find PythonInterp (missing:  PYTHON_EXECUTABLE) (Required is at least version "2.7")
Could NOT find PythonInterp (missing:  PYTHON_EXECUTABLE) (Required is at least version "2.6")
Could NOT find PythonInterp (missing:  PYTHON_EXECUTABLE) (Required is at least version "3.4")
Could NOT find PythonInterp (missing:  PYTHON_EXECUTABLE) (Required is at least version "3.2")
Found apache ant 1.8.2: C:/NVPACK/apache-ant-1.8.2/bin/ant.bat
VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
Caffe:   NO
Protobuf:   NO
Glog:   NO
Module opencv_sfm disabled because the following dependencies are not found: Eigen Glog/Gflags
Could NOT find Protobuf (missing:  Protobuf_LIBRARIES Protobuf_INCLUDE_DIR) 
Build libprotobuf from sources:
    libprotobuf not found into system
    The protocol buffer compiler not found
Tesseract:   NO

General configuration for OpenCV 3.1.0-dev =====================================
  Version control:               unknown

  Extra modules:
    Location (extra):            C:/opencv-3.0/source/opencv_contrib/modules
    Version control (extra):     unknown

    Timestamp:                   2016-08-19T14:52:58Z
    Host:                        Windows 10.0.10586 AMD64
    CMake:                       3.6.1
    CMake generator:             Visual Studio 14 2015 Win64
    CMake build tool:            C:/Program Files (x86)/MSBuild/14.0/bin/MSBuild.exe
    MSVC:                        1900

    Built as dynamic libs?:      YES
    C++ Compiler:                C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe  (ver 19.0.23506.0)
    C++ flags (Release):         /DWIN32 /D_WINDOWS /W4 /GR /EHa  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /wd4251 /wd4324 /wd4275 /wd4589 /MP4  /MD /O2 /Ob2 /DNDEBUG  /Zi
edit retag flag offensive close merge delete


thanks to use small icon 101010 to format code and output results

LBerger gravatar imageLBerger ( 2016-08-19 12:04:58 -0500 )edit

Keep in mind that the integrated OCR module is in contrib modules, which equals about to your on your own there, because the is still buggy and not well maintained.... I guess you would get better luck accessing a forum specific to tesseract OCR.

StevenPuttemans gravatar imageStevenPuttemans ( 2016-08-23 08:47:58 -0500 )edit