Hello, 

I want to read word by word from sub images. I use below code to get sub 
> image 

 

>                        int x1 = 50, y1 = 50, tempW = 100, tempH = 100;     
>                                                                             
>                                                                             
>         tesseract::TessBaseAPI *api = new tesseract::TessBaseAPI();

api->Init(NULL, "eng");

Mat im = imread("1.jpg");

cv::Mat sub = im(cv::Rect(x1, y1, tempW, tempH)); // x, y, width, height

api->SetImage((uchar*)sub.data, sub.size().width, sub.size().height, 
> sub.channels(), sub.step1());



Now, I want to read each word via : 

tesseract::ResultIterator* ri = api->GetIterator();

tesseract::PageIteratorLevel level = tesseract::RIL_WORD; 

if (ri != 0) {

do {

const char* word = ri->GetUTF8Text(level);

//float conf = ri->Confidence(level);

int x1, y1, x2, y2;

ri->BoundingBox(level, &x1, &y1, &x2, &y2);

printf("word: '%s';  \t; BoundingBox: %d,%d,%d,%d;\n",

   word, x1, y1, x2, y2);

delete[] word;

} while (ri->Next(level));

}


I get error... How can I do this? 

>  

-- 
-- 
You received this message because you are subscribed to the Google
Groups "tesseract-ocr" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/tesseract-ocr?hl=en
--- 
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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to