I am updating samples / c / motempl.c to OCV 2.3 and I am a bit puzzled by the cv :: updateMotionHistory () method. I am creating a story following what I saw in motempl.c:
history = cv::Mat::zeros(640, 480, CV_32FC1);
Then I call updateMotionHistory () as follows:
cv::Mat diff = cv::Mat::zeros(640, 480, CV_8U); if(prevFrame.size().width != 0) { cv::absdiff(currentFrame, prevFrame, diff); } else { return; } cv::updateMotionHistory( diff, history, getElapsedSeconds(), MHI_DURATION);
Everything seems to be in order, but he always throws the following:
OpenCV Error: Sizes of input arguments do not match () in cvUpdateMotionHistory
Both matrices are the same size, 640, 480, but just for fun, I tried changing the history to CV_8U, which gets me:
OpenCV Error: Unsupported format or combination of formats () in cvUpdateMotionHistory
Following the example where it is:
mhi = cvCreateImage( size, IPL_DEPTH_32F, 1 );
I understand why the story should be a floating image, I'm just not sure how to call this method using matrices, not IplImage instances. Thanks!
Joshua noble
source share