
int mode, // Contour retrieval mode (Figure 8-2)
int method, // Approximation method
cv::Point offset = cv::Point() // (optional) Offset every point
);
The be
inte ted as binary (i.e., as if all nonzero pixels were equivalent to one another). When it runs,
g one of the two forms of
fir
rpre
st argument is the input image; this image should be an 8-bit single-channel image and will
cv::findContours() will actually use this image as scratch space for computation, so if you need that
image for anything later, you should make a copy and pass that to cv::findContours(). The second
argument is an array of arrays, which in most practical cases will mean an STL vector of STL vectors. This
will be filled with the list of contours found (i.e., it will be a vector of contours, where contours[i] will
be a specific contour and thus contours[i][j] would refer to a specific vertex in contour[i]).
The next argument can be either supplied or not supplied (by usinhierarchy
the function shown above). If supplied, hierarchy is the output that describes the tree structure of the
contours. The output hierarchy will be an array (again typically an STL vector) with one entry for each
contour in contours. Each such entry will contain an array of four elements, each indicating the node to
which a particular link from the current node is connected (Error! Reference source not found.).