I try to find contours in a binary image but when try to execute cvFindContours it gives me that error message 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 I using fresh installed Ubuntu 11.10 and Opencv 2.3.1. Here is my source 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) my original and binary image Original image http://tinypic.com/r/34rul9x/6 and blue filtered binary image http://tinypic.com/r/ifbotx/6 Continue reading...