Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Are you sure that image was read properly and was converted to gray? It is the only input of findContours that may be corrupted so it worth checking (store the image in file just before call to findContours).

About your other question: Contour is stored as array (vector) of Point. So to keep multiple contours you need vector< vector< Point> >. In some application you are interested not only in contours but also in their hierarchy, i.e. which contours are inside another contours. If you are new to OpenCV, start from simpler call to findContours, the one without hierarchy.

findContours( image, contours, CV_RETR_LIST, CV_CHAIN_APPROX_SIMPLE);

Here you can see other flags that may be used by findContours.

Here you can see description of Vec4i, if you are still curious.