title: Opencv Contour Error
body: <p>I want to find contours of my image then I want to draw contour using openCV. I'm using VS 2012 and OpenCV 2.4.5 
  I wrote sample code about finding contours and drawing contours.
  Bu I stacked that horrible error :)  For any help I will be appreciated</p>
  
  <pre><code>void MyClass::findContoursAndDraw(cv::Mat image,int b,int g,int r)
  {
  findContours(image,contours,CV_RETR_LIST,CV_CHAIN_APPROX_SIMPLE);
  for(int i=0;i&lt;contours.size();i++)
  {
      int size=cv::contourArea(contours[i]);
      if(size&gt;500)
      {
          printf("%i \n",size);
          drawContours(originalTemp,contours,i,cv::Scalar(b,g,r),2,8);        
      }
  
  }
  </code></pre>
  
  <p>}</p>
  
  <pre><code>void MyClass::findContoursAndDrawFilled(cv::Mat image,int b,int g,int r)
  {
  findContours(image,contours,CV_RETR_LIST,CV_CHAIN_APPROX_SIMPLE);
  for(int i=0;i&lt;contours.size();i++)
  {
      int size=cv::contourArea(contours[i]);
      if(size&gt;3000)
      {
          printf("%i \n",size);
          drawContours(originalImg,contours,i,cv::Scalar(b,g,r));     
      }
  
  }
  }
  </code></pre>
  
  <p>My threshold and other necessary function works very well. But My program stacked at finding contour and drawcontour function. Says that:</p>
  
  <pre><code> Unhandled exception at 0x00B3A52A (opencv_imgproc245d.dll) in OpencvTest.exe: 
   0xC0000005: Access violation reading location 0xCDCDCDCD
  </code></pre>