MCPcopy Create free account
hub / github.com/creatale/node-dv / AddBoxTohOCR

Function AddBoxTohOCR

deps/tesseract/api/baseapi.cpp:1374–1396  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1372}
1373
1374static void AddBoxTohOCR(const ResultIterator* it, PageIteratorLevel level,
1375 STRING* hocr_str) {
1376 int left, top, right, bottom;
1377 it->BoundingBox(level, &left, &top, &right, &bottom);
1378 // This is the only place we use double quotes instead of single quotes,
1379 // but it may too late to change for consistency
1380 hocr_str->add_str_int(" title=\"bbox ", left);
1381 hocr_str->add_str_int(" ", top);
1382 hocr_str->add_str_int(" ", right);
1383 hocr_str->add_str_int(" ", bottom);
1384 // Add baseline coordinates & heights for textlines only.
1385 if (level == RIL_TEXTLINE) {
1386 AddBaselineCoordsTohOCR(it, level, hocr_str);
1387 // add custom height measures
1388 float row_height, descenders, ascenders; // row attributes
1389 it->RowAttributes(&row_height, &descenders, &ascenders);
1390 // TODO(rays): Do we want to limit these to a single decimal place?
1391 hocr_str->add_str_double("; x_size ", row_height);
1392 hocr_str->add_str_double("; x_descenders ", descenders * -1);
1393 hocr_str->add_str_double("; x_ascenders ", ascenders);
1394 }
1395 *hocr_str += "\">";
1396}
1397
1398static void AddBoxToTSV(const PageIterator* it, PageIteratorLevel level,
1399 STRING* hocr_str) {

Callers 1

GetHOCRTextMethod · 0.85

Calls 5

AddBaselineCoordsTohOCRFunction · 0.85
BoundingBoxMethod · 0.80
add_str_intMethod · 0.80
RowAttributesMethod · 0.80
add_str_doubleMethod · 0.80

Tested by

no test coverage detected