The problem has been solved.The reason is that the binary image should use
white as background and black as foreground,
Maybe there exist some issues during my training process.

易鑫 <yixinlucky...@gmail.com> 于2019年1月30日周三 上午10:38写道:

> 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 tesseract-ocr+unsubscr...@googlegroups.com.
> To post to this group, send email to tesseract-ocr@googlegroups.com.
> 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
> <https://groups.google.com/d/msgid/tesseract-ocr/3f61f056-9aee-4967-ab13-cfced376f8fc%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 tesseract-ocr+unsubscr...@googlegroups.com.
To post to this group, send email to tesseract-ocr@googlegroups.com.
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/CAPiKE209yLqXK7k%2BSN%3DSby4f283A0hoyPb8BNJHXLwWBJzpUUg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to