title: How to find the differences between frames using OpenCV?
body: <p>How can I find the differences between frames when I'm running video on OpenCV? I need to do a loop that checks the changes from frame to frame and displays the result in another window?
  Can I  do it in the loop that i attach here? Or is there another way to do it? </p>
  
  <pre><code>while( key != 'x' )  
  {  
     frame = cvQueryFrame( capture );
     cvCvtColor(frame, gray, CV_RGB2GRAY);
  
     //gray_frame = cvQueryFrame( capture );
  
     //cvCvtColor(frame, gray_frame, CV_BGR2GRAY);
  
     if(key==27)
          break;
  
     cvShowImage( "video",frame );
     cvShowImage( "grayvideo",gray );
  
     key = cvWaitKey( 1000 / fps );  
  }  
  cvDestroyWindow( "video" );  
  cvDestroyWindow( "grayvideo" ); 
  cvReleaseCapture( &amp;capture );  
  
  return 0;
  </code></pre>
  
  <hr>
  
  <p>i get this error on the command window: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>what is wrong maby the maby the size of depth?
  how can i fix it? or maby something wrong with the code?
  thanks a lot for your help</p>