Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

the api has changed a bit with opencv3, it should be:

img, contours, hierarchy = cv2.findContours(th,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)

there is not much documentation, unfortunately, but still, in cases like this you should try the builtin help function:

>>> help(cv2.findContours)
Help on built-in function findContours:

findContours(...)
    findContours(image, mode, method[, contours[, hierarchy[, offset]]]) -> image, contours, hierarchy

the api has changed a bit with opencv3, it should be:

img, contours, hierarchy = cv2.findContours(th,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)

(in other words, it returns more arguments, than you have variables there)

there is not much documentation, unfortunately, but still, in cases like this you should try the builtin help function:

>>> help(cv2.findContours)
Help on built-in function findContours:

findContours(...)
    findContours(image, mode, method[, contours[, hierarchy[, offset]]]) -> image, contours, hierarchy