当前位置: 首页>>代码示例>>C++>>正文


C++ TBOX::bounding_union方法代码示例

本文整理汇总了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;
}
开发者ID:avinashvarna,项目名称:Tesseract-Indic-OCR,代码行数:11,代码来源:baseapi.cpp

示例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;
}
开发者ID:avinashvarna,项目名称:Tesseract-Indic-OCR,代码行数:13,代码来源:baseapi.cpp

示例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;
}
开发者ID:0xkasun,项目名称:Dummy_Tes,代码行数:56,代码来源:pageiterator.cpp


注:本文中的TBOX::bounding_union方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。