hey i tried to do subtraction between current frame to previous, (the code attached ) the code running but i get errors and gray window without result the errors i got on command prompt:
Compiler did not align stack variables. Libavcodec has been miscompiled and may be very slow or crash. This is not a bug in libavcodec, but in the compiler. You may try recompiling using gcc >= 4.2. Do not report crashes to FFmpeg developers. OpenCV Error: Assertion failed (src1.size() == dst.size() && src1.type() == dst. type()) in unknown function, file ........\ocv\opencv\src\cxcore\cxarithm.cpp , line 1563.
someone have an idea? please your help!! thank you
int main()
{
int key = 0;
CvCapture* capture = cvCaptureFromAVI( "macroblock.mpg" );
IplImage* frame = cvQueryFrame( capture );
IplImage* currframe = cvCreateImage(cvGetSize(frame),IPL_DEPTH_8U,1);
IplImage* destframe = cvCreateImage(cvGetSize(frame),IPL_DEPTH_8U,1);
if ( !capture )
{
fprintf( stderr, "Cannot open AVI!\n" );
return 1;
}
int fps = ( int )cvGetCaptureProperty( capture, CV_CAP_PROP_FPS );
cvNamedWindow( "dest", CV_WINDOW_AUTOSIZE );
while( key != 'x' )
{
frame = cvQueryFrame( capture );
currframe = cvCloneImage( frame );// copy frame to current
frame = cvQueryFrame( capture );// grab frame
cvSub(frame,currframe,destframe);// subtraction between the last frame to cur
if(key==27 )break;
cvShowImage( "dest",destframe);
key = cvWaitKey( 1000 / fps );
}
cvDestroyWindow( "dest" );
cvReleaseCapture( &capture );
return 0;
}