Skip to content

Commit 29d971e

Browse files
committed
Fix text box width/hight calculation
In Tesseract's coordinate system, width is just right - left, cf. slide #2 of github.com/tesseract-ocr/docs/blob/master/das_tutorial2016/2ArchitectureAndDataStructures.pdf
1 parent 86acff5 commit 29d971e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

api/baseapi.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1431,8 +1431,8 @@ static void AddBoxToTSV(const PageIterator *it,
14311431
it->BoundingBox(level, &left, &top, &right, &bottom);
14321432
hocr_str->add_str_int("\t", left);
14331433
hocr_str->add_str_int("\t", top);
1434-
hocr_str->add_str_int("\t", right - left + 1);
1435-
hocr_str->add_str_int("\t", bottom - top + 1);
1434+
hocr_str->add_str_int("\t", right - left);
1435+
hocr_str->add_str_int("\t", bottom - top);
14361436
}
14371437

14381438

api/renderer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ bool TessHOcrRenderer::AddImageHandler(TessBaseAPI* api) {
196196
}
197197

198198
/**********************************************************************
199-
* HOcr Text Renderer interface implementation
199+
* TSV Text Renderer interface implementation
200200
**********************************************************************/
201201
TessTsvRenderer::TessTsvRenderer(const char *outputbase)
202202
: TessResultRenderer(outputbase, "tsv") {

0 commit comments

Comments
 (0)