Hello!
I am stucked in trying to figure out what is wrong with my code. I am doing
exactly
the same as in comment in cube_object.h file:
// The typical usage pattern for Cube is shown below://// // Create and
initialize Tesseract object and get its// // CubeRecoContext object
(note that Tesseract object owns it,// // so it will be freed when the
Tesseract object is freed).// tesseract::Tesseract *tess_obj = new
tesseract::Tesseract();// tess_obj->init_tesseract(data_path, lang,
tesseract::OEM_CUBE_ONLY);// CubeRecoContext *cntxt =
tess_obj->GetCubeRecoContext();// CHECK(cntxt != NULL) << "Unable to
create a Cube reco context";// .// .// .// //
Do this to recognize a word in pix whose co-ordinates are// //
(left,top,width,height)// tesseract::CubeObject *cube_obj;//
cube_obj = new tesseract::CubeObject(cntxt, pix,//
left, top, width, height);//// // Get back Cube's list
of answers// tesseract::WordAltList *alt_list =
cube_obj->RecognizeWord();// CHECK(alt_list != NULL &&
alt_list->AltCount() > 0);//// // Get the string and cost of every
alternate// for (int alt = 0; alt < alt_list->AltCount(); alt++) {//
// Return the result as a UTF-32 string// string_32 res_str32
= alt_list->Alt(alt);// // Convert to UTF8 if need-be//
string res_str;// CubeUtils::UTF32ToUTF8(res_str32.c_str(),
&res_str);// // Get the string cost. This should get bigger as you go
deeper// // in the list// int cost =
alt_list->AltCost(alt);// }//// // Call this once you are done
recognizing this word// delete cube_obj;//// // Call this once
you are done recognizing all words with// // for the current language//
delete tess_obj;//// Note that if the language supports "Italics" (see
the CubeRecoContext), the// RecognizeWord function attempts to de-slant the
word.
But I am obtaining wrong recognition results. Contrary, if I recognize the same
image through TessBaseAPI interface with OEM_CUBE_ONLY turned on I am getting
nice and correct results.
Should example from comment in cube_object.h work correctly?
--
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