title: subtraction frames opencv
body: <p>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:</p>
  
  <p>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() &amp;&amp; src1.type() == dst. type()) in unknown function, file ........\ocv\opencv\src\cxcore\cxarithm.cpp , line 1563.</p>
  
  <p>someone have an idea? please your help!! thank you</p>
  
  <pre><code>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( &amp;capture );
         return 0;
  </code></pre>
  
  <p>}</p>