From the documentation:
C++: void
findContours(InputOutputArray image,
OutputArrayOfArrays contours,
OutputArray hierarchy, int mode, int
method, Point offset=Point())
contours – Detected contours. Each contour is stored as a vector of points.
hierarchy – Optional output vector, containing information about the image topology. It has as many elements as the number of contours. For each i-th contour contours[i] , the elements hierarchy[i][0] , hiearchy[i][1] , hiearchy[i][2] , and hiearchy[i][3] are set to 0-based indices in contours of the next and previous contours at the same hierarchical level, the first child contour and the parent contour, respectively. If for the contour i there are no next, previous, parent, or nested contours, the corresponding elements of hierarchy[i] will be negative.
So Hierarchies contains information about the image topology, and has the same number of elements as contours.
Contours will contain all the detected contours. If contours isn't 30 but you expect it to be 30, then there is probably something going wrong beforehand.
Why don't you try drawing the contours onto your image to see what is being detected?
contours.size() : read doc
if i use this command i get the number 1077
Please post your whole code.