valueerror need more than 2 values to unpack findcontours
if cv2.getVersionMajor() in [2, 4]: # OpenCV 2, OpenCV 4 case contour, hier = cv2.findContours( thresh.copy(), cv2.RETR_CCOMP, cv2.CHAIN_APPROX_NONE) else: # OpenCV 3 case image, contour, hier = cv2.findContours( thresh.copy(), cv2.RETR_CCOMP, cv2.CHAIN_APPROX_NONE)