I\'m writing an opencv program and I found a script on another stackoverflow question: Computer Vision: Masking a human hand
When I run the scripted answer, I get th
This works in all cv2 versions:
contours, hierarchy = cv2.findContours(skin_ycrcb, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)[-2:]
Explanation: By using [-2:], we are basically taking the last two values from the tuple returned by cv2.findContours. Since in some versions, it returns (image, contours, hierarchy) and in other versions it returns (contours, hierarchy), contours, hierarchy are always the last two values.