Hello,everyone:
    I have fine tuned a new lstm model named engtuned.traineddata. I have 
test it in the command line,it is okay.

In the command line:
PS D:\git_workspace\TableOcrRecognition\Tesserac-OCR-Train> *tesseract 
D:\git_workspace\TableOcrRecognition\TableDetect\TableDetect\Data\Tmp\2.png 
stdout -l engtuned --psm 7 --oem 3*
Warning: Invalid resolution 0 dpi. Using 70 instead.
Q345L90X8

The result is good,but when I used it in C++ code,it can not recognize the 
characters correctly.Here is my C++ code.

 tesseract::TessBaseAPI *tessApi = new tesseract::TessBaseAPI();
    // --psm 7 --oem 3
    if (tessApi->Init("../../tessdata", "engtuned", 
tesseract::OcrEngineMode::OEM_DEFAULT)) {
        std::cout << "OCRTesseract: Could not initialize tesseract." << 
std::endl;
        return EINITTESS;
    }
    // setup
    tessApi->SetPageSegMode(tesseract::PageSegMode::PSM_SINGLE_LINE);
    tessApi->SetVariable("save_best_choices", "T");


    ...

   tessApi->SetImage(binImg.data, binImg.cols, binImg.rows, binImg.step[1], 
binImg.step[0]);
        
    tessApi->Recognize(0);
    string result = std::unique_ptr<char[]>(tessApi->GetUTF8Text()).get();
    cout << result < <endl;

I do not know where is wrong,can you help? thanks a lot.

-- 
You received this message because you are subscribed to the Google Groups 
"tesseract-ocr" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tesseract-ocr.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tesseract-ocr/3f61f056-9aee-4967-ab13-cfced376f8fc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to