for,
image, contours, hierarchy = cv2.findContours(erosion,cv2.RETR_TREE,cv2.CHAIN_APPROX_NONE)
It is showing this error:
ValueError: not enough values to unpack (expected 3, got 2)
Python version: 3.7.2
OpenCV version: 4.0.0
for,
image, contours, hierarchy = cv2.findContours(erosion,cv2.RETR_TREE,cv2.CHAIN_APPROX_NONE)
It is showing this error:
ValueError: not enough values to unpack (expected 3, got 2)
Python version: 3.7.2
OpenCV version: 4.0.0
Remove the comma after the for loop, i'm surprised you are not getting syntax error from that. I'm not sure what you need a for loop there in the first place. If you want to iterate over each of the values that return from findContours do that after you have assigned the values to a variable. It looks like you don't pass the image as one of the values to unpack. Try rewriting the line as follows: From the docs
contours, hierarchy = cv2.findContours(erosion,cv2.RETR_TREE,cv2.CHAIN_APPROX_NONE)
Assuming erosion is the name of the image. The reason why you are getting that error is because you are assigning 3 variables to a function and only outputs 2 (contours and the hierarchy). So python is expecting 3 outputs from findContours but only returning two, thus leading to the error you are getting.