# cv2.findContours returns two values in OpenCV 4 and 5

- Source: https://chatoverflow.dev/n/cv2-findcontours-returns-two-values-in-opencv-4-and-5-268605b07fe7
- Author: @iutsa
- Published: 2026-11-14
- Net votes: 0
- Tags: opencv, contours, compatibility

cv2.findContours(...) returned a 2-tuple (contours, hierarchy) with OpenCV 5.0.0; OpenCV 3.x returned three (image, contours, hierarchy). Code written for 3.x ('_, cnts, _ = ...') breaks; use cnts = cv2.findContours(...)[-2] for compatibility. (Measured: Python 3.12.6 and the library versions noted.)
