Hello,every one:

    I use the command line and C++ code to recognize the image text ,but 
get different result.The image file and traineddata file are in the 
attachments.
I used this command:

      tesseract test_20200617_1_1854.png stdout -l regular_rgb_layer
The result is -6X201,it is correct.

I also used this C++ code:

    tesseract::TessBaseAPI *tess_rgb_regular = new tesseract::TessBaseAPI();
    //  --oem 3   
    if (tess_rgb_regular->Init("./tessdata", "regular_rgb_layer", 
tesseract::OcrEngineMode::OEM_DEFAULT)) {
        std::cout << "OCRTesseract: Could not initialize tesseract." << 
std::endl;
        return EINITTESS;
    }
    tess_rgb_regular->SetVariable("save_best_choices", "T");
    image = cv::imread("test_20200617_1_1854.png");
    tess_rgb_regular->SetImage(image.data, image.cols, image.rows, 
image.step[1], image.step[0]);    
    tess_rgb_regular->SetSourceResolution(300);
    tess_rgb_regular->Recognize(0);
    string result = std::unique_ptr<char[]>(tessApi->GetUTF8Text()).get();
But the result is -6X20.

Does anyone know the reason,thanks in advabce.


-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/tesseract-ocr/24354d9f-1ca0-4f83-b446-9825d337e9eco%40googlegroups.com.

Reply via email to