本文整理汇总了C++中BLOBNBOX::blob方法的典型用法代码示例。如果您正苦于以下问题:C++ BLOBNBOX::blob方法的具体用法?C++ BLOBNBOX::blob怎么用?C++ BLOBNBOX::blob使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BLOBNBOX
的用法示例。
在下文中一共展示了BLOBNBOX::blob方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: clear_blobnboxes
static void clear_blobnboxes(BLOBNBOX_LIST* boxes) {
BLOBNBOX_IT it = boxes;
// A BLOBNBOX generally doesn't own its blobs, so if they do, you
// have to delete them explicitly.
for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
BLOBNBOX* box = it.data();
if (box->blob() != NULL)
delete box->blob();
if (box->cblob() != NULL)
delete box->cblob();
}
}
示例3: box_next
BOX box_next( //get bounding box
BLOBNBOX_IT *it //iterator to blobds
) {
BLOBNBOX *blob; //current blob
BOX result; //total box
blob = it->data ();
result = blob->bounding_box ();
do {
it->forward ();
blob = it->data ();
if (blob->blob () == NULL && blob->cblob () == NULL)
//was pre-chopped
result += blob->bounding_box ();
}
//until next real blob
while (blob->blob () == NULL && blob->cblob () == NULL || blob->joined_to_prev ());
return result;
}
示例4: compute_vertical_projection
void TO_ROW::compute_vertical_projection() { //project whole row
BOX row_box; //bound of row
BLOBNBOX *blob; //current blob
BOX blob_box; //bounding box
BLOBNBOX_IT blob_it = blob_list ();
if (blob_it.empty ())
return;
row_box = blob_it.data ()->bounding_box ();
for (blob_it.mark_cycle_pt (); !blob_it.cycled_list (); blob_it.forward ())
row_box += blob_it.data ()->bounding_box ();
projection.set_range (row_box.left () - PROJECTION_MARGIN,
row_box.right () + PROJECTION_MARGIN);
projection_left = row_box.left () - PROJECTION_MARGIN;
projection_right = row_box.right () + PROJECTION_MARGIN;
for (blob_it.mark_cycle_pt (); !blob_it.cycled_list (); blob_it.forward ()) {
blob = blob_it.data ();
if (blob->blob () != NULL)
vertical_blob_projection (blob->blob (), &projection);
else if (blob->cblob () != NULL)
vertical_cblob_projection (blob->cblob (), &projection);
}
}