本文整理汇总了C++中WERD类的典型用法代码示例。如果您正苦于以下问题:C++ WERD类的具体用法?C++ WERD怎么用?C++ WERD使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WERD类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: make_single_word
void make_single_word(bool one_blob, TO_ROW_LIST *rows, ROW_LIST* real_rows) {
TO_ROW_IT to_row_it(rows);
TO_ROW* row = to_row_it.data();
// The blobs have to come out of the BLOBNBOX into the C_BLOB_LIST ready
// to create the word.
C_BLOB_LIST cblobs;
C_BLOB_IT cblob_it(&cblobs);
BLOBNBOX_IT box_it(row->blob_list());
for (;!box_it.empty(); box_it.forward()) {
BLOBNBOX* bblob= box_it.extract();
if (bblob->joined_to_prev() || (one_blob && !cblob_it.empty())) {
if (bblob->cblob() != NULL) {
C_OUTLINE_IT cout_it(cblob_it.data()->out_list());
cout_it.move_to_last();
cout_it.add_list_after(bblob->cblob()->out_list());
delete bblob->cblob();
}
} else {
if (bblob->cblob() != NULL)
cblob_it.add_after_then_move(bblob->cblob());
delete bblob;
}
}
// Convert the TO_ROW to a ROW.
ROW* real_row = new ROW(row, static_cast<inT16>(row->kern_size),
static_cast<inT16>(row->space_size));
WERD_IT word_it(real_row->word_list());
WERD* word = new WERD(&cblobs, 0, NULL);
word->set_flag(W_BOL, TRUE);
word->set_flag(W_EOL, TRUE);
word_it.add_after_then_move(word);
ROW_IT row_it(real_rows);
row_it.add_after_then_move(real_row);
}
开发者ID:mk219533,项目名称:tesseract-ocr,代码行数:34,代码来源:wordseg.cpp
示例2: floor
WERD *add_repeated_word( //move repeated word
WERD_IT *rep_it, //repeated words
int16_t &rep_left, //left edge of word
int16_t &prev_chop_coord, //previous word end
uint8_t &blanks, //no of blanks
float pitch, //char cell size
WERD_IT *word_it //list of words
) {
WERD *word; //word to move
int16_t new_blanks; //extra blanks
if (rep_left > prev_chop_coord) {
new_blanks = (uint8_t) floor ((rep_left - prev_chop_coord) / pitch + 0.5);
blanks += new_blanks;
}
word = rep_it->extract ();
prev_chop_coord = word->bounding_box ().right ();
word_it->add_after_then_move (word);
word->set_blanks (blanks);
rep_it->forward ();
if (rep_it->empty ())
rep_left = INT16_MAX;
else
rep_left = rep_it->data ()->bounding_box ().left ();
blanks = 0;
return word;
}
开发者ID:CDOcr,项目名称:tesseract,代码行数:27,代码来源:fpchop.cpp
示例3: PrintSegmentationStats
void PrintSegmentationStats(BLOCK_LIST* block_list) {
int num_blocks = 0;
int num_rows = 0;
int num_words = 0;
int num_blobs = 0;
BLOCK_IT block_it(block_list);
for (block_it.mark_cycle_pt(); !block_it.cycled_list(); block_it.forward()) {
BLOCK* block = block_it.data();
++num_blocks;
ROW_IT row_it(block->row_list());
for (row_it.mark_cycle_pt(); !row_it.cycled_list(); row_it.forward()) {
++num_rows;
ROW* row = row_it.data();
// Iterate over all werds in the row.
WERD_IT werd_it(row->word_list());
for (werd_it.mark_cycle_pt(); !werd_it.cycled_list(); werd_it.forward()) {
WERD* werd = werd_it.data();
++num_words;
num_blobs += werd->cblob_list()->length();
}
}
}
tprintf("Block list stats:\nBlocks = %d\nRows = %d\nWords = %d\nBlobs = %d\n",
num_blocks, num_rows, num_words, num_blobs);
}
开发者ID:0359xiaodong,项目名称:tess-two,代码行数:25,代码来源:ocrblock.cpp
示例4: make_pseudo_word
PAGE_RES_IT* make_pseudo_word(PAGE_RES* page_res, const TBOX& selection_box) {
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
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));
}
}
if (!new_blobs.empty()) {
WERD* pseudo_word = new WERD(&new_blobs, 1, NULL);
word_res = pr_it.InsertSimpleCloneWord(*word_res, pseudo_word);
PAGE_RES_IT* it = new PAGE_RES_IT(page_res);
while (it->word() != word_res && it->word() != NULL) it->forward();
ASSERT_HOST(it->word() == word_res);
return it;
}
}
}
return NULL;
}
开发者ID:0ximDigital,项目名称:appsScanner,代码行数:29,代码来源:werdit.cpp
示例5: PreenXHeights
/// Builds a PAGE_RES from the block_list in the way required for ApplyBoxes:
/// All fuzzy spaces are removed, and all the words are maximally chopped.
PAGE_RES* Tesseract::SetupApplyBoxes(const GenericVector<TBOX>& boxes,
BLOCK_LIST *block_list) {
PreenXHeights(block_list);
// Strip all fuzzy space markers to simplify the PAGE_RES.
BLOCK_IT b_it(block_list);
for (b_it.mark_cycle_pt(); !b_it.cycled_list(); b_it.forward()) {
BLOCK* block = b_it.data();
ROW_IT r_it(block->row_list());
for (r_it.mark_cycle_pt(); !r_it.cycled_list(); r_it.forward ()) {
ROW* row = r_it.data();
WERD_IT w_it(row->word_list());
for (w_it.mark_cycle_pt(); !w_it.cycled_list(); w_it.forward()) {
WERD* word = w_it.data();
if (word->cblob_list()->empty()) {
delete w_it.extract();
} else {
word->set_flag(W_FUZZY_SP, false);
word->set_flag(W_FUZZY_NON, false);
}
}
}
}
PAGE_RES* page_res = new PAGE_RES(false, block_list, NULL);
PAGE_RES_IT pr_it(page_res);
WERD_RES* word_res;
while ((word_res = pr_it.word()) != NULL) {
MaximallyChopWord(boxes, pr_it.block()->block,
pr_it.row()->row, word_res);
pr_it.forward();
}
return page_res;
}
开发者ID:0xkasun,项目名称:tesseract,代码行数:34,代码来源:applybox.cpp
示例6: word_it
// Remove outlines that are a tiny fraction in either width or height
// of the word height.
void Textord::clean_small_noise_from_words(ROW *row) {
WERD_IT word_it(row->word_list());
for (word_it.mark_cycle_pt(); !word_it.cycled_list(); word_it.forward()) {
WERD* word = word_it.data();
int min_size = static_cast<int>(
textord_noise_hfract * word->bounding_box().height() + 0.5);
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();
C_OUTLINE_IT out_it(blob->out_list());
for (out_it.mark_cycle_pt(); !out_it.cycled_list(); out_it.forward()) {
C_OUTLINE* outline = out_it.data();
outline->RemoveSmallRecursive(min_size, &out_it);
}
if (blob->out_list()->empty()) {
delete blob_it.extract();
}
}
if (word->cblob_list()->empty()) {
if (!word_it.at_last()) {
// The next word is no longer a fuzzy non space if it was before,
// since the word before is about to be deleted.
WERD* next_word = word_it.data_relative(1);
if (next_word->flag(W_FUZZY_NON)) {
next_word->set_flag(W_FUZZY_NON, false);
}
}
delete word_it.extract();
}
}
}
开发者ID:dqsoft,项目名称:tesseract,代码行数:33,代码来源:tordmain.cpp
示例7: TAL_make_single_word
//yangjing01 modified :
bool TAL_make_single_word(bool one_blob, TO_ROW_LIST* rows, ROW_LIST* real_rows)
{
TO_ROW_IT to_row_it(rows);
ROW_IT row_it(real_rows);
//to_real_row is the real row information of single row or single char mode
TO_ROW* real_to_row = NULL;
float row_max_height = 0.0;
for (to_row_it.mark_cycle_pt();
!to_row_it.cycled_list(); to_row_it.forward()){
TO_ROW* row = to_row_it.data();
float row_min_y = row->min_y();
float row_max_y = row->max_y();
float row_height = abs(row_max_y - row_min_y);
if (real_to_row == NULL
|| row_height > row_max_height
|| fabs(row_height - row_max_height) < 1.0f){
row_max_height = row_height;
real_to_row = row;
}
}
if (real_to_row == NULL){
return false;
}
C_BLOB_LIST cblobs;
C_BLOB_IT cblob_it(&cblobs);
BLOBNBOX_IT box_it(real_to_row->blob_list());
for (; !box_it.empty(); box_it.forward()){
BLOBNBOX* bblob = box_it.extract();
if (bblob->joined_to_prev() || (one_blob && !cblob_it.empty())) {
if (bblob->cblob() != NULL){
C_OUTLINE_IT cout_it(cblob_it.data()->out_list());
cout_it.move_to_last();
cout_it.add_list_after(bblob->cblob()->out_list());
delete bblob->cblob();
}
}
else {
if (bblob->cblob() != NULL)
cblob_it.add_after_then_move(bblob->cblob());
}
delete bblob;
}
// Convert the TO_ROW to a ROW.
ROW* real_row = new ROW(real_to_row, static_cast<inT16>(real_to_row->kern_size),
static_cast<inT16>(real_to_row->space_size));
WERD_IT word_it(real_row->word_list());
WERD* word = new WERD(&cblobs, 0, NULL);
word->set_flag(W_BOL, TRUE);
word->set_flag(W_EOL, TRUE);
word->set_flag(W_DONT_CHOP, one_blob);
word_it.add_after_then_move(word);
row_it.add_after_then_move(real_row);
return true;
}
开发者ID:dipthomas,项目名称:tesseract,代码行数:58,代码来源:wordseg.cpp
示例8: if
WERD *make_real_word(BLOBNBOX_IT *box_it, //iterator
inT32 blobcount, //no of blobs to use
BOOL8 bol, //start of line
uinT8 blanks //no of blanks
) {
OUTLINE_IT out_it; // outlines
C_OUTLINE_IT cout_it;
PBLOB_LIST blobs; // blobs in word
C_BLOB_LIST cblobs;
PBLOB_IT blob_it = &blobs; // iterator
C_BLOB_IT cblob_it = &cblobs;
WERD *word; // new word
BLOBNBOX *bblob; // current blob
inT32 blobindex; // in row
for (blobindex = 0; blobindex < blobcount; blobindex++) {
bblob = box_it->extract();
if (bblob->joined_to_prev()) {
if (bblob->blob() != NULL) {
out_it.set_to_list(blob_it.data()->out_list());
out_it.move_to_last();
out_it.add_list_after(bblob->blob()->out_list());
delete bblob->blob();
}
else if (bblob->cblob() != NULL) {
cout_it.set_to_list(cblob_it.data()->out_list());
cout_it.move_to_last();
cout_it.add_list_after(bblob->cblob()->out_list());
delete bblob->cblob();
}
}
else {
if (bblob->blob() != NULL)
blob_it.add_after_then_move(bblob->blob());
else if (bblob->cblob() != NULL)
cblob_it.add_after_then_move(bblob->cblob());
}
delete bblob;
box_it->forward(); // next one
}
if (blanks < 1)
blanks = 1;
if (blob_it.empty())
word = new WERD(&cblobs, blanks, NULL);
else
word = new WERD(&blobs, blanks, NULL);
if (bol)
word->set_flag(W_BOL, TRUE);
if (box_it->at_first())
word->set_flag(W_EOL, TRUE); // at end of line
return word;
}
开发者ID:coffeesam,项目名称:tesseract-ocr,代码行数:56,代码来源:wordseg.cpp
示例9: plot
void ROW::plot( //draw it
ScrollView* window //window to draw in
) {
WERD *word; //current word
WERD_IT it = &words; //words of ROW
for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ()) {
word = it.data ();
word->plot (window); //in rainbow colours
}
}
开发者ID:0359xiaodong,项目名称:tess-two,代码行数:11,代码来源:ocrrow.cpp
示例10: BOOL8
/**
* @name process_selected_words()
*
* Walk the current block list applying the specified word processor function
* to each word that overlaps the selection_box.
*/
void Tesseract::process_selected_words(
PAGE_RES* page_res, // blocks to check
TBOX & selection_box,
BOOL8(tesseract::Tesseract::*word_processor)(PAGE_RES_IT* pr_it)) {
for (PAGE_RES_IT page_res_it(page_res); page_res_it.word() != NULL;
page_res_it.forward()) {
WERD* word = page_res_it.word()->word;
if (word->bounding_box().overlap(selection_box)) {
if (!(this->*word_processor)(&page_res_it))
return;
}
}
}
开发者ID:0xkasun,项目名称:tesseract,代码行数:19,代码来源:pagewalk.cpp
示例11: apply_box_training
void apply_box_training(BLOCK_LIST *block_list) {
BLOCK_IT block_it(block_list);
ROW_IT row_it;
ROW *row;
WERD_IT word_it;
WERD *word;
WERD *bln_word;
WERD copy_outword; // copy to denorm
PBLOB_IT blob_it;
DENORM denorm;
INT16 count = 0;
char ch[2];
ch[1] = '\0';
tprintf ("Generating training data\n");
for (block_it.mark_cycle_pt ();
!block_it.cycled_list (); block_it.forward ()) {
row_it.set_to_list (block_it.data ()->row_list ());
for (row_it.mark_cycle_pt (); !row_it.cycled_list (); row_it.forward ()) {
row = row_it.data ();
word_it.set_to_list (row->word_list ());
for (word_it.mark_cycle_pt ();
!word_it.cycled_list (); word_it.forward ()) {
word = word_it.data ();
if ((strlen (word->text ()) == 1) &&
(word->gblob_list ()->length () == 1)) {
/* Here is a word with a single char label and a single blob so train on it */
bln_word =
make_bln_copy (word, row, row->x_height (), &denorm);
blob_it.set_to_list (bln_word->blob_list ());
ch[0] = *word->text ();
tess_training_tester (blob_it.data (),
//single blob
&denorm, TRUE, //correct
ch, //correct ASCII char
1, //ASCII length
NULL);
copy_outword = *(bln_word);
copy_outword.baseline_denormalise (&denorm);
blob_it.set_to_list (copy_outword.blob_list ());
ch[0] = *word->text ();
delete bln_word;
count++;
}
}
}
}
tprintf ("Generated training data for %d blobs\n", count);
}
开发者ID:jan-ruzicka,项目名称:tesseract-ocr-sf,代码行数:50,代码来源:applybox.cpp
示例12: WERD
WERD *make_real_word(BLOBNBOX_IT *box_it, //iterator
int32_t blobcount, //no of blobs to use
bool bol, //start of line
uint8_t blanks //no of blanks
) {
C_OUTLINE_IT cout_it;
C_BLOB_LIST cblobs;
C_BLOB_IT cblob_it = &cblobs;
WERD *word; // new word
BLOBNBOX *bblob; // current blob
int32_t blobindex; // in row
for (blobindex = 0; blobindex < blobcount; blobindex++) {
bblob = box_it->extract();
if (bblob->joined_to_prev()) {
if (bblob->cblob() != nullptr) {
cout_it.set_to_list(cblob_it.data()->out_list());
cout_it.move_to_last();
cout_it.add_list_after(bblob->cblob()->out_list());
delete bblob->cblob();
}
}
else {
if (bblob->cblob() != nullptr)
cblob_it.add_after_then_move(bblob->cblob());
}
delete bblob;
box_it->forward(); // next one
}
if (blanks < 1)
blanks = 1;
word = new WERD(&cblobs, blanks, nullptr);
if (bol)
word->set_flag(W_BOL, true);
if (box_it->at_first())
word->set_flag(W_EOL, true); // at end of line
return word;
}
开发者ID:tesseract-ocr,项目名称:tesseract,代码行数:42,代码来源:wordseg.cpp
示例13: RefreshWordBlobsFromNewBlobs
void RefreshWordBlobsFromNewBlobs(BLOCK_LIST* block_list,
C_BLOB_LIST* new_blobs,
C_BLOB_LIST* not_found_blobs) {
// Now iterate over all the blobs in the segmentation_block_list_, and just
// replace the corresponding c-blobs inside the werds.
BLOCK_IT block_it(block_list);
for (block_it.mark_cycle_pt(); !block_it.cycled_list(); block_it.forward()) {
BLOCK* block = block_it.data();
if (block->poly_block() != NULL && !block->poly_block()->IsText())
continue; // Don't touch non-text blocks.
// Iterate over all rows in the block.
ROW_IT row_it(block->row_list());
for (row_it.mark_cycle_pt(); !row_it.cycled_list(); row_it.forward()) {
ROW* row = row_it.data();
// Iterate over all werds in the row.
WERD_IT werd_it(row->word_list());
WERD_LIST new_words;
WERD_IT new_words_it(&new_words);
for (werd_it.mark_cycle_pt(); !werd_it.cycled_list(); werd_it.forward()) {
WERD* werd = werd_it.extract();
WERD* new_werd = werd->ConstructWerdWithNewBlobs(new_blobs,
not_found_blobs);
if (new_werd) {
// Insert this new werd into the actual row's werd-list. Remove the
// existing one.
new_words_it.add_after_then_move(new_werd);
delete werd;
} else {
// Reinsert the older word back, for lack of better options.
// This is critical since dropping the words messes up segmentation:
// eg. 1st word in the row might otherwise have W_FUZZY_NON turned on.
new_words_it.add_after_then_move(werd);
}
}
// Get rid of the old word list & replace it with the new one.
row->word_list()->clear();
werd_it.move_to_first();
werd_it.add_list_after(&new_words);
}
}
}
开发者ID:Kailigithub,项目名称:tesseract,代码行数:41,代码来源:ocrblock.cpp
示例14: Baseline
/**
* Returns the baseline of the current object at the given level.
* The baseline is the line that passes through (x1, y1) and (x2, y2).
* WARNING: with vertical text, baselines may be vertical!
*/
bool PageIterator::Baseline(PageIteratorLevel level,
int* x1, int* y1, int* x2, int* y2) const {
if (it_->word() == NULL) return false; // Already at the end!
ROW* row = it_->row()->row;
WERD* word = it_->word()->word;
TBOX box = (level == RIL_WORD || level == RIL_SYMBOL)
? word->bounding_box()
: row->bounding_box();
int left = box.left();
ICOORD startpt(left, static_cast<inT16>(row->base_line(left) + 0.5));
int right = box.right();
ICOORD endpt(right, static_cast<inT16>(row->base_line(right) + 0.5));
// Rotate to image coordinates and convert to global image coords.
startpt.rotate(it_->block()->block->re_rotation());
endpt.rotate(it_->block()->block->re_rotation());
*x1 = startpt.x() / scale_ + rect_left_;
*y1 = (rect_height_ - startpt.y()) / scale_ + rect_top_;
*x2 = endpt.x() / scale_ + rect_left_;
*y2 = (rect_height_ - endpt.y()) / scale_ + rect_top_;
return true;
}
开发者ID:0xkasun,项目名称:Dummy_Tes,代码行数:26,代码来源:pageiterator.cpp
示例15: ExtractBlobsFromSegmentation
void ExtractBlobsFromSegmentation(BLOCK_LIST* blocks,
C_BLOB_LIST* output_blob_list) {
C_BLOB_IT return_list_it(output_blob_list);
BLOCK_IT block_it(blocks);
for (block_it.mark_cycle_pt(); !block_it.cycled_list(); block_it.forward()) {
BLOCK* block = block_it.data();
ROW_IT row_it(block->row_list());
for (row_it.mark_cycle_pt(); !row_it.cycled_list(); row_it.forward()) {
ROW* row = row_it.data();
// Iterate over all werds in the row.
WERD_IT werd_it(row->word_list());
for (werd_it.mark_cycle_pt(); !werd_it.cycled_list(); werd_it.forward()) {
WERD* werd = werd_it.data();
return_list_it.move_to_last();
return_list_it.add_list_after(werd->cblob_list());
return_list_it.move_to_last();
return_list_it.add_list_after(werd->rej_cblob_list());
}
}
}
}
开发者ID:0359xiaodong,项目名称:tess-two,代码行数:21,代码来源:ocrblock.cpp
示例16: row_it
// Fixes the block so it obeys all the rules:
// Must have at least one ROW.
// Must have at least one WERD.
// WERDs contain a fake blob.
void Textord::cleanup_nontext_block(BLOCK* block) {
// Non-text blocks must contain at least one row.
ROW_IT row_it(block->row_list());
if (row_it.empty()) {
const TBOX& box = block->pdblk.bounding_box();
float height = box.height();
int32_t xstarts[2] = {box.left(), box.right()};
double coeffs[3] = {0.0, 0.0, static_cast<double>(box.bottom())};
ROW* row = new ROW(1, xstarts, coeffs, height / 2.0f, height / 4.0f,
height / 4.0f, 0, 1);
row_it.add_after_then_move(row);
}
// Each row must contain at least one word.
for (row_it.mark_cycle_pt(); !row_it.cycled_list(); row_it.forward()) {
ROW* row = row_it.data();
WERD_IT w_it(row->word_list());
if (w_it.empty()) {
// Make a fake blob to put in the word.
TBOX box = block->row_list()->singleton() ? block->pdblk.bounding_box()
: row->bounding_box();
C_BLOB* blob = C_BLOB::FakeBlob(box);
C_BLOB_LIST blobs;
C_BLOB_IT blob_it(&blobs);
blob_it.add_after_then_move(blob);
WERD* word = new WERD(&blobs, 0, nullptr);
w_it.add_after_then_move(word);
}
// Each word must contain a fake blob.
for (w_it.mark_cycle_pt(); !w_it.cycled_list(); w_it.forward()) {
WERD* word = w_it.data();
// Just assert that this is true, as it would be useful to find
// out why it isn't.
ASSERT_HOST(!word->cblob_list()->empty());
}
row->recalc_bounding_box();
}
}
开发者ID:dqsoft,项目名称:tesseract,代码行数:41,代码来源:tordmain.cpp
示例17: word_set_display
/**
* word_set_display() Word processor
*
* Display word according to current display mode settings
*/
BOOL8 Tesseract::word_set_display(BLOCK* block, ROW* row, WERD_RES* word_res) {
WERD* word = word_res->word;
word->set_display_flag(DF_BOX, word_display_mode.bit(DF_BOX));
word->set_display_flag(DF_TEXT, word_display_mode.bit(DF_TEXT));
word->set_display_flag(DF_POLYGONAL, word_display_mode.bit(DF_POLYGONAL));
word->set_display_flag(DF_EDGE_STEP, word_display_mode.bit(DF_EDGE_STEP));
word->set_display_flag(DF_BN_POLYGONAL,
word_display_mode.bit(DF_BN_POLYGONAL));
word->set_display_flag(DF_BLAMER, word_display_mode.bit(DF_BLAMER));
return word_display(block, row, word_res);
}
开发者ID:ErfanHasmin,项目名称:scope-ocr,代码行数:16,代码来源:pgedit.cpp
示例18: word_set_display
/**
* word_set_display() Word processor
*
* Display word according to current display mode settings
*/
BOOL8 Tesseract::word_set_display(PAGE_RES_IT* pr_it) {
WERD* word = pr_it->word()->word;
word->set_display_flag(DF_BOX, word_display_mode.bit(DF_BOX));
word->set_display_flag(DF_TEXT, word_display_mode.bit(DF_TEXT));
word->set_display_flag(DF_POLYGONAL, word_display_mode.bit(DF_POLYGONAL));
word->set_display_flag(DF_EDGE_STEP, word_display_mode.bit(DF_EDGE_STEP));
word->set_display_flag(DF_BN_POLYGONAL,
word_display_mode.bit(DF_BN_POLYGONAL));
word->set_display_flag(DF_BLAMER, word_display_mode.bit(DF_BLAMER));
return word_display(pr_it);
}
开发者ID:xmarston,项目名称:BillRecognizer,代码行数:16,代码来源:pgedit.cpp
示例19: recalc_bounding_box
void ROW::recalc_bounding_box() { //recalculate BB
WERD *word; //current word
WERD_IT it = &words; //words of ROW
inT16 left; //of word
inT16 prev_left; //old left
if (!it.empty ()) {
word = it.data ();
prev_left = word->bounding_box ().left ();
it.forward ();
while (!it.at_first ()) {
word = it.data ();
left = word->bounding_box ().left ();
if (left < prev_left) {
it.move_to_first ();
//words in BB order
it.sort (word_comparator);
break;
}
prev_left = left;
it.forward ();
}
}
for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ()) {
word = it.data ();
if (it.at_first ())
word->set_flag (W_BOL, TRUE);
else
//not start of line
word->set_flag (W_BOL, FALSE);
if (it.at_last ())
word->set_flag (W_EOL, TRUE);
else
//not end of line
word->set_flag (W_EOL, FALSE);
//extend BB as reqd
bound_box += word->bounding_box ();
}
}
开发者ID:0359xiaodong,项目名称:tess-two,代码行数:39,代码来源:ocrrow.cpp
示例20: pr_it
/// Resegments the words by running the classifier in an attempt to find the
/// correct segmentation that produces the required string.
void Tesseract::ReSegmentByClassification(PAGE_RES* page_res) {
PAGE_RES_IT pr_it(page_res);
WERD_RES* word_res;
for (; (word_res = pr_it.word()) != NULL; pr_it.forward()) {
WERD* word = word_res->word;
if (word->text() == NULL || word->text()[0] == '\0')
continue; // Ignore words that have no text.
// Convert the correct text to a vector of UNICHAR_ID
GenericVector<UNICHAR_ID> target_text;
if (!ConvertStringToUnichars(word->text(), &target_text)) {
tprintf("APPLY_BOX: FAILURE: can't find class_id for '%s'\n",
word->text());
pr_it.DeleteCurrentWord();
continue;
}
if (!FindSegmentation(target_text, word_res)) {
tprintf("APPLY_BOX: FAILURE: can't find segmentation for '%s'\n",
word->text());
pr_it.DeleteCurrentWord();
continue;
}
}
}
开发者ID:0xkasun,项目名称:tesseract,代码行数:25,代码来源:applybox.cpp
注:本文中的WERD类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论