Skip to content

Commit

Permalink
Fix text box width/hight calculation
Browse files Browse the repository at this point in the history
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
  • Loading branch information
StefRe committed Jun 25, 2016
1 parent 86acff5 commit 29d971e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions api/baseapi.cpp
Expand Up @@ -1431,8 +1431,8 @@ static void AddBoxToTSV(const PageIterator *it,
it->BoundingBox(level, &left, &top, &right, &bottom);
hocr_str->add_str_int("\t", left);
hocr_str->add_str_int("\t", top);
hocr_str->add_str_int("\t", right - left + 1);
hocr_str->add_str_int("\t", bottom - top + 1);
hocr_str->add_str_int("\t", right - left);
hocr_str->add_str_int("\t", bottom - top);
}


Expand Down
2 changes: 1 addition & 1 deletion api/renderer.cpp
Expand Up @@ -196,7 +196,7 @@ bool TessHOcrRenderer::AddImageHandler(TessBaseAPI* api) {
}

/**********************************************************************
* HOcr Text Renderer interface implementation
* TSV Text Renderer interface implementation
**********************************************************************/
TessTsvRenderer::TessTsvRenderer(const char *outputbase)
: TessResultRenderer(outputbase, "tsv") {
Expand Down

0 comments on commit 29d971e

Please sign in to comment.