Tesseract  3.02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
werdit.cpp File Reference
#include "mfcpch.h"
#include "werdit.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.

{ // Row of selection.
PAGE_RES_IT pr_it(page_res);
C_BLOB_LIST new_blobs; // list of gathered blobs
C_BLOB_IT new_blob_it = &new_blobs; // iterator
WERD *pseudo_word; // fabricated word
for (WERD_RES* word_res = pr_it.word(); word_res != NULL;
word_res = pr_it.forward()) {
WERD* word = word_res->word;
if (word->bounding_box().overlap(selection_box)) {
C_BLOB_IT blob_it(word->cblob_list());
for (blob_it.mark_cycle_pt();
!blob_it.cycled_list(); blob_it.forward()) {
C_BLOB* blob = blob_it.data();
if (blob->bounding_box().overlap(selection_box)) {
new_blob_it.add_after_then_move(C_BLOB::deep_copy(blob));
pseudo_row = pr_it.row()->row;
pseudo_block = pr_it.block()->block;
}
}
}
}
if (!new_blobs.empty())
pseudo_word = new WERD(&new_blobs, 1, NULL);
else
pseudo_word = NULL;
return pseudo_word;
}