本文整理汇总了C++中VO_Shape::GetShapeBoundRect方法的典型用法代码示例。如果您正苦于以下问题:C++ VO_Shape::GetShapeBoundRect方法的具体用法?C++ VO_Shape::GetShapeBoundRect怎么用?C++ VO_Shape::GetShapeBoundRect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VO_Shape
的用法示例。
在下文中一共展示了VO_Shape::GetShapeBoundRect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EvaluateFaceTrackedByProbabilityImage
/**
* @param trackalg- input and output the track algorithm,
will record some information for every frame
* @param iImg - input input image
* @param iShape - input the current tracked shape
* @return bool whether the tracked shape is acceptable?
*/
bool CRecognitionAlgs::EvaluateFaceTrackedByProbabilityImage(
CTrackingAlgs* trackalg,
const Mat& iImg,
const VO_Shape& iShape,
Size smallSize,
Size bigSize)
{
double t = (double)cvGetTickCount();
Rect rect = iShape.GetShapeBoundRect();
trackalg->SetConfiguration( CTrackingAlgs::CAMSHIFT,
CTrackingAlgs::PROBABILITYIMAGE);
trackalg->Tracking( rect,
iImg,
smallSize,
bigSize );
bool res = false;
if( !trackalg->IsObjectTracked() )
res = false;
else if ( ((double)rect.height/(double)rect.width <= 0.75)
|| ((double)rect.height/(double)rect.width >= 2.5) )
res = false;
else
res = true;
t = ((double)cvGetTickCount() - t )
/ (cvGetTickFrequency()*1000.);
cout << "Camshift Tracking time cost: " << t << "millisec" << endl;
return res;
}
示例2: translation
/**
* @brief First Estimation of the fitted shape by scaling only
* @param iShape -- input shape
* @param rect -- the rectangle to calculate the scalar
* @return VO_Shape -- the scaled shape
*/
VO_Shape VO_Fitting2DSM::VO_FirstEstimationByScaling( const VO_Shape& iShape,
const cv::Rect& rect )
{
VO_Shape res = iShape;
cv::Rect_<float> rect0 = iShape.GetShapeRect();
float fScaleX = (float)rect.width/rect0.width *0.80;
float fScaleY = (float)rect.height/rect0.height *0.80;
res.ScaleX(fScaleX);
res.ScaleY(fScaleY);
rect0 = iShape.GetShapeBoundRect();
cv::Mat_<float> translation = cv::Mat_<float>::zeros(2, 1);
float centerX = (float)rect.x + (float)rect.width/2.0f;
float centerY = (float)rect.y + (float)rect.height/2.0f;
float center0X = (float)rect0.x + (float)rect0.width/2.0f;
float center0Y = (float)rect0.x + (float)rect0.height/2.0f;
translation(0,0) = centerX - center0X;
translation(1,0) = centerY - center0Y;
res.Translate( translation );
return res;
}