title: Subtraction of Frames : OPEN CV:
body: <p>I am stuck up on an error while capturing the difference of two frames :</p>
  
  <pre><code>for(;;)
  {   
      colourImage = cvQueryFrame(input);
      diff=cvCloneImage(colourImage);
      colourImage=cvQueryFrame(input);
      cvAbsDiff(colourImage,diff,subtract);
      cvCvtColor(subtract,greyImage,CV_RGB2GRAY);
      cvShowImage("bg subtracted ",greyImage);
      cvThreshold(greyImage, greyImage, 70, 255, CV_THRESH_BINARY);
      cvDilate(greyImage, greyImage, 0, 18);
      cvErode(greyImage, greyImage, 0, 10);
      cvShowImage("final",greyImage);
      cvWaitKey(33);
      :
      followed to contour extraction.
  }
  </code></pre>
  
  <p>After displaying the "final" window , the program terminates without going to the contour section.
  The following error is being displayed :</p>
  
  <pre><code>    OpenCV Error: Assertion failed (src1.size == dst.size &amp;&amp; src1.type() == dst.type()) in cvAbsDiff, file /home/ukri/src/OpenCV-2.4.2/modules/core/src/arithm.cpp, line 2786,terminate called after throwing an instance of 'cv::Exception' , what():  /home/ukri/src/OpenCV-2.4.2/modules/core/src/arithm.cpp:2786: error: (-215) src1.size == dst.size &amp;&amp; src1.type() == dst.type() in function cvAbsDiff.AbortedOpenCV Error: Assertion failed (src1.size == dst.size &amp;&amp; src1.type() == dst.type()) in cvAbsDiff, file /home/ukri/src/OpenCV-2.4.2/modules/core/src/arithm.cpp, line 2786terminate called after throwing an instance of 'cv::Exception'  what():  /home/ukri/src/OpenCV-2.4.2/modules/core/src/arithm.cpp:2786: error: (-215) src1.size == dst.size &amp;&amp; src1.type() == dst.type() in function cvAbsDiff.Aborted
  </code></pre>
  
  <p>I made the image type of colourImage , diff and subtract the same. Still the error keeps on recurring.</p>