无法在opencv 3.2.0中调用cv :: updateMotionHistory()

时间:2017-01-05 22:11:54

标签: c++ qt opencv motion-detection


" Hello world"使用opencv 3.2.0的其他一些例子正在运行,但我对 updateMotionHistory()函数有一些麻烦。

void VMotionDetector::detectMovingRegions( const cv::Mat& currentFrame, double timestamp,
                                           std::vector<cv::Rect>& targets , cv::Mat& mask )
{
    cv::GaussianBlur( currentFrame, m_bluredImage, cv::Size( 3, 3 ), -1 );
    cv::absdiff( m_bluredImage, m_previousImage, mask );
    cv::threshold( mask, mask,  MOTION_THRESHOLD, 255, cv::THRESH_BINARY );
    cv::morphologyEx( mask, mask, cv::MORPH_CLOSE, cv::Mat() );
    cv::morphologyEx( mask, mask, cv::MORPH_OPEN, m_openingKernel,
                      cv::Point( -1, -1 ), 1, cv::BORDER_CONSTANT, cv::Scalar( 0 ) );
    cv::updateMotionHistory( mask, m_motionHistoryImage, timestamp, m_motionHistoryDuration );
    cv::segmentMotion( m_motionHistoryImage, m_segmask, targets, timestamp, m_maxMotionGradient );

    std::vector<cv::Rect>::iterator endIt = targets.end( );
    for( std::vector<cv::Rect>::iterator it = targets.begin( ); it != endIt; ++it ) {
        if( cv::countNonZero( mask( * it ) ) < MIN_CONTOUR_AREA )
            targets.erase( it );
    }

    m_bluredImage.copyTo( m_previousImage );
}

所以,这是错误:

/root/opencvsand/main.cpp:34: error: 'updateMotionHistory' is not a member of 'cv'
             cv::updateMotionHistory(*someargumets*) ;
             ^~

/root/opencvsand/main.cpp:35: error: 'segmentMotion' is not a member of 'cv'
     cv::segmentMotion( m_motionHistoryImage, m_segmask, targets, timestamp, m_maxMotionGradient );
     ^~

如果我尝试使用 cvUpdateMotionHistory(),编译器会说:

/root/opencvsand/main.cpp:35: error: undefined reference to `cvUpdateMotionHistory'

具有此功能的所有示例均无效。

0 个答案:

没有答案