Tesseract  3.02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
werdit.h File Reference
#include "pageres.h"
#include "notdll.h"

Go to the source code of this file.

Functions

WERDmake_pseudo_word (PAGE_RES *page_res, TBOX &selection_box, BLOCK *&pseudo_block, ROW *&pseudo_row)
 

Function Documentation

WERD* make_pseudo_word ( PAGE_RES page_res,
TBOX selection_box,
BLOCK *&  pseudo_block,
ROW *&  pseudo_row 
)

Definition at line 30 of file werdit.cpp.

33  { // Row of selection.
34  PAGE_RES_IT pr_it(page_res);
35  C_BLOB_LIST new_blobs; // list of gathered blobs
36  C_BLOB_IT new_blob_it = &new_blobs; // iterator
37  WERD *pseudo_word; // fabricated word
38 
39  for (WERD_RES* word_res = pr_it.word(); word_res != NULL;
40  word_res = pr_it.forward()) {
41  WERD* word = word_res->word;
42  if (word->bounding_box().overlap(selection_box)) {
43  C_BLOB_IT blob_it(word->cblob_list());
44  for (blob_it.mark_cycle_pt();
45  !blob_it.cycled_list(); blob_it.forward()) {
46  C_BLOB* blob = blob_it.data();
47  if (blob->bounding_box().overlap(selection_box)) {
48  new_blob_it.add_after_then_move(C_BLOB::deep_copy(blob));
49  pseudo_row = pr_it.row()->row;
50  pseudo_block = pr_it.block()->block;
51  }
52  }
53  }
54  }
55  if (!new_blobs.empty())
56  pseudo_word = new WERD(&new_blobs, 1, NULL);
57  else
58  pseudo_word = NULL;
59  return pseudo_word;
60 }
TBOX bounding_box()
Definition: werd.cpp:164
C_BLOB_LIST * cblob_list()
Definition: werd.h:100
#define NULL
Definition: host.h:144
bool overlap(const TBOX &box) const
Definition: rect.h:345
WERD * word
Definition: pageres.h:334
Definition: werd.h:60
static C_BLOB * deep_copy(const C_BLOB *src)
Definition: stepblob.h:76
TBOX bounding_box()
Definition: stepblob.cpp:192