本文整理汇总了C++中Blob::getBoundingRect方法的典型用法代码示例。如果您正苦于以下问题:C++ Blob::getBoundingRect方法的具体用法?C++ Blob::getBoundingRect怎么用?C++ Blob::getBoundingRect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Blob
的用法示例。
在下文中一共展示了Blob::getBoundingRect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: matchingArea
int Blob::matchingArea( const Blob& blob ) const
{
cv::Rect area;
if( !overlappingAreaRect( blob, area ) )
return 0;
return area.area();
#if 0
//minimum area rectangle containing a and b
cv::Rect r = d->boundingRect | blob.getBoundingRect();
cv::Mat m(r.size(), CV_8UC1);
m = cv::Scalar(0);
for( unsigned int i=0; i<d->contour.size(); ++i)
{
const cv::Point& p = d->contour[i];
m.at<uchar>(p.x,p.y) = 1;
}
int count = 0;
const std::vector<cv::Point>& contour = blob.getContour();
for( unsigned int i=0; i<contour.size(); ++i)
{
const cv::Point& p = contour[i];
if( m.at<uchar>(p.x,p.y) == 1 ) ++count;
}
return count;
#endif
}
示例2: overlappingAreaRect
bool Blob::overlappingAreaRect( const Blob& other, cv::Rect& area ) const
{
const cv::Rect& rect = other.getBoundingRect();
return overlappingArea( d->boundingRect, rect, area ) > 0;
}