Can not call cv::updateMotionHistory() in opencv 3.2.0

636 views Asked by At


"Hello world" and some other examples using opencv 3.2.0 are working, but I have some troubles with updateMotionHistory() function.

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 );
}

So, here is errors:

/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 );
     ^~

If I try to use cvUpdateMotionHistory(), compiler says:

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

All examples with this function don't work.

0

There are 0 answers