#include <iostream>
#include <string>
#include <tesseract/baseapi.h>
#include <leptonica/allheaders.h>
#include <opencv2/opencv.hpp>

using namespace std;
using namespace cv;

int main()
{
std::string outText, imPath = "image.jpeg"; 
cv::Mat im = cv::imread(imPath, cv::IMREAD_GRAYSCALE); 
cv::bitwise_not(im, im); 
tesseract::TessBaseAPI* ocr = new tesseract::TessBaseAPI(); 
ocr->Init(NULL, "eng", tesseract::OEM_DEFAULT) 
ocr->SetImage(im.data, im.cols, im.rows, 1, im.step); 
outText = std::string(ocr->GetUTF8Text()); 
ocr->End(); 
system("pause");
}

On Thursday, December 31, 2020 at 1:55:54 PM UTC-6 zdenop wrote:

> 1. Do not post code snittpet - provide full testing case for easy 
> replication
> 2. Provide details: which OS, which compiler, how did build/get tesseract, 
> which version... etc.
>
> Zdenko
>
>
> št 31. 12. 2020 o 20:53 Minseok Kim <minseok....@gmail.com> napísal(a):
>
>> std::string outText, imPath = "image.jpeg"; 
>> cv::Mat im = cv::imread(imPath, cv::IMREAD_GRAYSCALE); 
>> cv::bitwise_not(im, im); 
>> tesseract::TessBaseAPI* ocr = new tesseract::TessBaseAPI(); 
>> ocr->Init(NULL, "eng", tesseract::OEM_DEFAULT) 
>> ocr->SetImage(im.data, im.cols, im.rows, 1, im.step); 
>> outText = std::string(ocr->GetUTF8Text()); 
>> ocr->End();  
>>
>> Anybody got any idea how to fix this issue?
>>
>> -- 
>> 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-oc...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/tesseract-ocr/205fedd4-235c-4810-8e49-5edc1fecd2c1n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/tesseract-ocr/205fedd4-235c-4810-8e49-5edc1fecd2c1n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/tesseract-ocr/6b687238-b0c4-4b31-901f-c0b39e23816an%40googlegroups.com.

Reply via email to