title: Python-OpenCv FindContours
body: <p>I try to find contours in a binary image but when try to execute cvFindContours it gives me that error message</p>
  
  <blockquote>
    <p>Traceback (most recent call last):   File "convert.py", line 30, in
    
        contour = cvFindContours(img2, storage, cv.CV_RETR_CCOMP, cv.CV_CHAIN_APPROX_SIMPLE)   File
    "/usr/lib/pymodules/python2.7/opencv/cv.py", line 580, in
    cvFindContours
        count, seq = cvFindContoursUntyped( *args )   File "/usr/lib/pymodules/python2.7/opencv/cv.py", line 6521, in
    cvFindContoursUntyped
        return _cv.cvFindContoursUntyped(*args) RuntimeError:  openCV Error:
            Status=Incorrect size of input array
            function name=cvStartFindContours
            error message=
            file_name=/build/buildd/opencv-2.1.0/src/cv/cvcontours.cpp
            line=205</p>
  </blockquote>
  
  <p>I using fresh installed Ubuntu 11.10 and Opencv 2.3.1.</p>
  
  <p>Here is my source code</p>
  
  <pre><code>from opencv.cv import *
  from opencv.highgui import *
  
  image = cvLoadImage('test.png')
  def getthresholdedimg(image):
      size = cvSize(640, 480)
  
      imghsv=cvCreateImage(cvGetSize(image),8,3)
      cvCvtColor(image,imghsv,cv.CV_BGR2HSV)
      imgblue=cvCreateImage(cvGetSize(image),8,1)
      imgblue2=cvCreateImage(cvGetSize(image),8,1)
      imgthreshold=cvCreateImage(cvGetSize(image),8,1)
  
      cvInRangeS(imghsv,cvScalar(100,100,100),cvScalar(120,255,255),imgblue)
      cvInRangeS(imghsv,cvScalar(100,100,100),cvScalar(120,255,255),imgblue2)
      cvAdd(imgblue,imgblue,imgthreshold)
      return imgthreshold
  
  
  cvFlip(image,image,1)
  
  cvSmooth(image, image, CV_GAUSSIAN, 3, 0)
  imgthresh=getthresholdedimg(image)
  cvErode(imgthresh,imgthresh,None,3)
  cvDilate(imgthresh,imgthresh,None,10)
  storage = cvCreateMemStorage(0)
  img2=cvCloneImage(imgthresh)
  contour = cvFindContours(img2, storage, cv.CV_RETR_CCOMP, cv.CV_CHAIN_APPROX_SIMPLE)
  </code></pre>
  
  <p>my original and binary image</p>
  
  <p>Original image
  <a href="http://tinypic.com/r/34rul9x/6" rel="nofollow">http://tinypic.com/r/34rul9x/6</a></p>
  
  <p>and blue filtered binary image
  <a href="http://tinypic.com/r/ifbotx/6" rel="nofollow">http://tinypic.com/r/ifbotx/6</a></p>