How to use `cv2.findContours` in different OpenCV versions?
An alternative to work with 2.x 、3.x、4.x is:
cnts, hiers = cv2.findContours(...)[-2:]
Notice:
cv2.findContours
has changed since OpenCV 3.x
, but in OpenCV 4.0
it changes back!!!
In OpenCV 3.4:
findContours(image, mode, method[, contours[, hierarchy[, offset]]]) -> image, contours, hierarchy
In OpenCV 4.0:
findContours(image, mode, method[, contours[, hierarchy[, offset]]]) -> contours, hierarchy