本文整理汇总了C++中TBOX::bounding_union方法的典型用法代码示例。如果您正苦于以下问题:C++ TBOX::bounding_union方法的具体用法?C++ TBOX::bounding_union怎么用?C++ TBOX::bounding_union使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TBOX
的用法示例。
在下文中一共展示了TBOX::bounding_union方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: c_blob_list_get_bbox
// TODO(mezhirov) delete this function and replace with word->bounding_box()
static TBOX c_blob_list_get_bbox(C_BLOB_LIST *cblobs) {
TBOX result;
C_BLOB_IT c_it(cblobs);
for (c_it.mark_cycle_pt(); !c_it.cycled_list(); c_it.forward()) {
C_BLOB *blob = c_it.data();
//bboxes.push(tessy_rectangle(blob->bounding_box()));
result.bounding_union(blob->bounding_box());
}
return result;
}
示例2: pblob_get_bbox
// brief Get a bounding box of a PBLOB.
// TODO(mezhirov) delete this function and replace with blob->bounding_box()
static TBOX pblob_get_bbox(PBLOB *blob) {
OUTLINE_LIST *outlines = blob->out_list();
OUTLINE_IT it(outlines);
TBOX result;
for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
OUTLINE *outline = it.data();
outline->compute_bb();
result.bounding_union(outline->bounding_box());
}
return result;
}
示例3: BoundingBoxInternal
/**
* Returns the bounding rectangle of the current object at the given level in
* the coordinates of the working image that is pix_binary().
* See comment on coordinate system above.
* Returns false if there is no such object at the current position.
*/
bool PageIterator::BoundingBoxInternal(PageIteratorLevel level,
int* left, int* top,
int* right, int* bottom) const {
if (Empty(level))
return false;
TBOX box;
PARA *para = NULL;
switch (level) {
case RIL_BLOCK:
box = it_->block()->block->bounding_box();
break;
case RIL_PARA:
para = it_->row()->row->para();
// explicit fall-through.
case RIL_TEXTLINE:
box = it_->row()->row->bounding_box();
break;
case RIL_WORD:
box = it_->word()->word->bounding_box();
break;
case RIL_SYMBOL:
if (cblob_it_ == NULL)
box = it_->word()->box_word->BlobBox(blob_index_);
else
box = cblob_it_->data()->bounding_box();
}
if (level == RIL_PARA) {
PageIterator other = *this;
other.Begin();
do {
if (other.it_->block() &&
other.it_->block()->block == it_->block()->block &&
other.it_->row() && other.it_->row()->row &&
other.it_->row()->row->para() == para) {
box = box.bounding_union(other.it_->row()->row->bounding_box());
}
} while (other.Next(RIL_TEXTLINE));
}
if (level != RIL_SYMBOL || cblob_it_ != NULL)
box.rotate(it_->block()->block->re_rotation());
// Now we have a box in tesseract coordinates relative to the image rectangle,
// we have to convert the coords to a top-down system.
const int pix_height = pixGetHeight(tesseract_->pix_binary());
const int pix_width = pixGetWidth(tesseract_->pix_binary());
*left = ClipToRange(static_cast<int>(box.left()), 0, pix_width);
*top = ClipToRange(pix_height - box.top(), 0, pix_height);
*right = ClipToRange(static_cast<int>(box.right()), *left, pix_width);
*bottom = ClipToRange(pix_height - box.bottom(), *top, pix_height);
return true;
}