Skip to content

Instantly share code, notes, and snippets.

@pvorb
Created April 19, 2014 09:45
Show Gist options
  • Save pvorb/11079466 to your computer and use it in GitHub Desktop.
Save pvorb/11079466 to your computer and use it in GitHub Desktop.
Correct Box coordinates by adding a static_cast in Tesseract 3.03
Index: ccmain/pageiterator.cpp
===================================================================
--- ccmain/pageiterator.cpp (Revision 1058)
+++ ccmain/pageiterator.cpp (Arbeitskopie)
@@ -288,9 +288,9 @@
const int pix_height = pixGetHeight(tesseract_->pix_binary());
const int pix_width = pixGetWidth(tesseract_->pix_binary());
*left = ClipToRange(static_cast<int>(box.left()), 0, pix_width);
- *top = ClipToRange(pix_height - box.top(), 0, pix_height);
+ *top = ClipToRange(pix_height - static_cast<int>(box.top()), 0, pix_height);
*right = ClipToRange(static_cast<int>(box.right()), *left, pix_width);
- *bottom = ClipToRange(pix_height - box.bottom(), *top, pix_height);
+ *bottom = ClipToRange(pix_height - static_cast<int>(box.bottom()), *top, pix_height);
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment