Resolve not enough values to unpack (Expected 3, got 2) error
Ref_,refCnts,hierarchy=cv2.findContours(ref.copy(), cv2.retr_external, cv2.chain_approx_simple)
The new version of OpenCV returns two arguments, while the old version used three arguments, so the error occurs. Just delete the first argument.