22 #include "allheaders.h" 30 int scaled_yres,
int rect_left,
int rect_top,
31 int rect_width,
int rect_height)
32 : page_res_(page_res),
38 include_upper_dots_(false),
39 include_lower_dots_(false),
41 scaled_yres_(scaled_yres),
42 rect_left_(rect_left),
44 rect_width_(rect_width),
45 rect_height_(rect_height) {
61 : page_res_(src.page_res_),
62 tesseract_(src.tesseract_),
64 word_length_(src.word_length_),
65 blob_index_(src.blob_index_),
67 include_upper_dots_(src.include_upper_dots_),
68 include_lower_dots_(src.include_lower_dots_),
70 scaled_yres_(src.scaled_yres_),
71 rect_left_(src.rect_left_),
72 rect_top_(src.rect_top_),
73 rect_width_(src.rect_width_),
74 rect_height_(src.rect_height_) {
97 return (
it_ == NULL &&
it_ == other) ||
98 ((other != NULL) && (
it_ != NULL) && (*
it_ == *other));
114 while (next_para.
cmp(*
it_) <= 0) {
147 if (
it_->
block() == NULL)
return false;
185 if (
it_->
block() == NULL)
return false;
186 if (
it_->
word() == NULL)
return true;
210 if (
Empty(element))
return true;
219 if (next.
Empty(element))
return true;
220 while (element > level) {
266 int* right,
int* bottom)
const {
326 int* right,
int* bottom)
const {
327 return BoundingBox(level, 0, left, top, right, bottom);
332 int* right,
int* bottom)
const {
349 if (
it_->
block() == NULL)
return true;
373 Pta* pta = ptaCreate(it.length());
375 for (it.mark_cycle_pt(); !it.cycled_list(); it.forward(), ++num_pts) {
408 int left, top, right, bottom;
414 Box* box = boxCreate(left, top, right - left, bottom - top);
421 int mask_x = left - mask_box.
left();
424 pixRasterop(pix,
MAX(0, -mask_x),
MAX(0, -mask_y), pixGetWidth(pix),
425 pixGetHeight(pix), PIX_SRC & PIX_DST, mask,
MAX(0, mask_x),
445 int* left,
int* top)
const {
447 if (!
BoundingBox(level, left, top, &right, &bottom))
449 if (original_img == NULL)
453 *left =
MAX(*left - padding, 0);
454 *top =
MAX(*top - padding, 0);
457 Box* box = boxCreate(*left, *top, right - *left, bottom - *top);
458 Pix* grey_pix = pixClipRectangle(original_img, box, NULL);
465 int mask_x = *left - mask_box.
left();
466 int mask_y = *top - (pixGetHeight(original_img) - mask_box.
top());
467 int width = pixGetWidth(grey_pix);
468 int height = pixGetHeight(grey_pix);
469 Pix* resized_mask = pixCreate(width, height, 1);
470 pixRasterop(resized_mask,
MAX(0, -mask_x),
MAX(0, -mask_y), width, height,
471 PIX_SRC, mask,
MAX(0, mask_x),
MAX(0, mask_y));
473 pixDilateBrick(resized_mask, resized_mask, 2 * padding + 1,
475 pixInvert(resized_mask, resized_mask);
476 pixSetMasked(grey_pix, resized_mask,
MAX_UINT32);
477 pixDestroy(&resized_mask);
488 int* x1,
int* y1,
int* x2,
int* y2)
const {
489 if (
it_->
word() == NULL)
return false;
495 int left = box.
left();
497 int right = box.
right();
512 float *deskew_angle)
const {
516 FCOORD up_in_image(0.0, 1.0);
520 if (up_in_image.
x() == 0.0F) {
521 if (up_in_image.
y() > 0.0F) {
526 }
else if (up_in_image.
x() > 0.0F) {
543 bool is_mongolian =
false;
544 *textline_order = is_vertical_text
552 *deskew_angle = -skew.
angle();
558 int *first_line_indent)
const {
578 if (word_res == NULL) {
591 tprintf(
"Corrupted word! best_choice[len=%d] = %s, box_word[len=%d]: ",
Pix * GetBinaryImage(PageIteratorLevel level) const
TBOX bounding_union(const TBOX &box) const
void rotate(const FCOORD &vec)
virtual bool IsAtBeginningOf(PageIteratorLevel level) const
virtual bool IsAtFinalElement(PageIteratorLevel level, PageIteratorLevel element) const
TBOX restricted_bounding_box(bool upper_dots, bool lower_dots) const
TBOX bounding_box() const
const TBOX & bounding_box() const
int cmp(const PAGE_RES_IT &other) const
PageIterator(PAGE_RES *page_res, Tesseract *tesseract, int scale, int scaled_yres, int rect_left, int rect_top, int rect_width, int rect_height)
BLOCK_RES * prev_block() const
float base_line(float xpos) const
const STRING & unichar_string() const
ICOORDELT_LIST * points()
bool IsWithinFirstTextlineOfParagraph() const
bool BoundingBox(PageIteratorLevel level, int *left, int *top, int *right, int *bottom) const
bool SetWordBlamerBundle(BlamerBundle *blamer_bundle)
PolyBlockType isA() const
T ClipToRange(const T &x, const T &lower_bound, const T &upper_bound)
void Orientation(tesseract::Orientation *orientation, tesseract::WritingDirection *writing_direction, tesseract::TextlineOrder *textline_order, float *deskew_angle) const
WERD_RES * forward_with_empties()
TESS_LOCAL void BeginWord(int offset)
WERD_CHOICE * best_choice
bool BoundingBoxInternal(PageIteratorLevel level, int *left, int *top, int *right, int *bottom) const
WERD_RES * forward_paragraph()
POLY_BLOCK * poly_block() const
void ParagraphInfo(tesseract::ParagraphJustification *justification, bool *is_list_item, bool *is_crown, int *first_line_indent) const
PolyBlockType BlockType() const
WERD_RES * forward_block()
const ParagraphModel * model
tesseract::BoxWord * box_word
Pix * render_mask(TBOX *mask_box)
int Cmp(const PageIterator &other) const
FCOORD re_rotation() const
const char * string() const
bool PositionedAtSameWord(const PAGE_RES_IT *other) const
bool is_very_first_or_continuation
void rotate(const FCOORD vec)
inT16 x() const
access function
Pta * BlockPolygon() const
BlamerBundle * blamer_bundle
WERD_RES * restart_page_with_empties()
bool Empty(PageIteratorLevel level) const
virtual bool Next(PageIteratorLevel level)
tesseract::ParagraphJustification justification() const
virtual void RestartRow()
virtual void RestartParagraph()
void rotate(const FCOORD &vec)
ROW_RES * prev_row() const
BLOCK_RES * block() const
const PageIterator & operator=(const PageIterator &src)
TBOX restricted_bounding_box(bool upper_dots, bool lower_dots) const
bool Baseline(PageIteratorLevel level, int *x1, int *y1, int *x2, int *y2) const
const TBOX & BlobBox(int index) const
bool right_to_left() const
FCOORD classify_rotation() const
Pix * GetImage(PageIteratorLevel level, int padding, Pix *original_img, int *left, int *top) const
void unrotate(const FCOORD &vec)
C_BLOB_LIST * cblob_list()
float angle() const
find angle
TBOX restricted_bounding_box(bool upper_dots, bool lower_dots) const
TBOX bounding_box() const
inT16 y() const
access_function