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


C++ VO_Shape::GetShapeBoundRect方法代码示例

本文整理汇总了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;
}
开发者ID:HVisionSensing,项目名称:mc-vosm,代码行数:40,代码来源:VO_RecognitionAlgs.cpp

示例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;
}
开发者ID:kod3r,项目名称:VOSM,代码行数:26,代码来源:VO_Fitting2DSM.cpp


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