本文整理汇总了C++中ColPartition::median_right方法的典型用法代码示例。如果您正苦于以下问题:C++ ColPartition::median_right方法的具体用法?C++ ColPartition::median_right怎么用?C++ ColPartition::median_right使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ColPartition
的用法示例。
在下文中一共展示了ColPartition::median_right方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EvaluateColPartition
// Evaluates the textlineiness of a ColPartition. Uses EvaluateBox below,
// but uses the median top/bottom for horizontal and median left/right for
// vertical instead of the bounding box edges.
// Evaluates for both horizontal and vertical and returns the best result,
// with a positive value for horizontal and a negative value for vertical.
int TextlineProjection::EvaluateColPartition(const ColPartition& part,
const DENORM* denorm,
bool debug) const {
if (part.IsSingleton())
return EvaluateBox(part.bounding_box(), denorm, debug);
// Test vertical orientation.
TBOX box = part.bounding_box();
// Use the partition median for left/right.
box.set_left(part.median_left());
box.set_right(part.median_right());
int vresult = EvaluateBox(box, denorm, debug);
// Test horizontal orientation.
box = part.bounding_box();
// Use the partition median for top/bottom.
box.set_top(part.median_top());
box.set_bottom(part.median_bottom());
int hresult = EvaluateBox(box, denorm, debug);
if (debug) {
tprintf("Partition hresult=%d, vresult=%d from:", hresult, vresult);
part.bounding_box().print();
part.Print();
}
return hresult >= -vresult ? hresult : vresult;
}
示例2: DistanceOfBoxFromPartition
// Compute the distance of the box from the partition using curved projection
// space. As DistanceOfBoxFromBox, except that the direction is taken from
// the ColPartition and the median bounds of the ColPartition are used as
// the to_box.
int TextlineProjection::DistanceOfBoxFromPartition(const TBOX& box,
const ColPartition& part,
const DENORM* denorm,
bool debug) const {
// Compute a partition box that uses the median top/bottom of the blobs
// within and median left/right for vertical.
TBOX part_box = part.bounding_box();
if (part.IsHorizontalType()) {
part_box.set_top(part.median_top());
part_box.set_bottom(part.median_bottom());
} else {
part_box.set_left(part.median_left());
part_box.set_right(part.median_right());
}
// Now use DistanceOfBoxFromBox to make the actual calculation.
return DistanceOfBoxFromBox(box, part_box, part.IsHorizontalType(),
denorm, debug);
}