30static void AddBoxToLSTM(
int right,
int bottom,
int top,
int image_height,
int page_num,
32 text +=
" " + std::to_string(image_height - bottom);
33 text +=
" " + std::to_string(right + 5);
34 text +=
" " + std::to_string(image_height - top);
35 text +=
" " + std::to_string(page_num);
43 std::string lstm_box_str;
44 bool first_word =
true;
45 int left = 0, top = 0, right = 0, bottom = 0;
56 lstm_box_str +=
" " + std::to_string(left);
57 AddBoxToLSTM(right, bottom, top,
image_height_, page_number, lstm_box_str);
62 lstm_box_str +=
"\t " + std::to_string(left);
63 AddBoxToLSTM(right, bottom, top,
image_height_, page_number, lstm_box_str);
75 lstm_box_str +=
" " + std::to_string(left);
76 AddBoxToLSTM(right, bottom, top,
image_height_, page_number, lstm_box_str);
80 lstm_box_str +=
"\t " + std::to_string(left);
81 AddBoxToLSTM(right, bottom, top,
image_height_, page_number, lstm_box_str);
84 char *ret =
new char[lstm_box_str.length() + 1];
85 strcpy(ret, lstm_box_str.c_str());
98 if (lstmbox ==
nullptr) {
int Recognize(ETEXT_DESC *monitor)
PAGE_RES * page_res_
The page-level data.
Tesseract * tesseract_
The underlying data object.
char * GetLSTMBoxText(int page_number)
LTRResultIterator * GetLTRIterator()
char * GetUTF8Text(PageIteratorLevel level) const
virtual bool Next(PageIteratorLevel level)
virtual bool IsAtBeginningOf(PageIteratorLevel level) const
bool Empty(PageIteratorLevel level) const
bool BoundingBox(PageIteratorLevel level, int *left, int *top, int *right, int *bottom) const
void AppendString(const char *s)
bool AddImageHandler(TessBaseAPI *api) override
TessLSTMBoxRenderer(const char *outputbase)