Home > database >  ValueError: not enough values to unpack (expected 3, got 2) when I try to capture a webcam images
ValueError: not enough values to unpack (expected 3, got 2) when I try to capture a webcam images

Time:10-08

I want to apply the python code published in the following page link [https://data-flair.training/blogs/sign-language-recognition-python-ml-opencv/] I faced a problem with using the data augmented from the camera, when I want to create the dataset by building it from the captured webcam images, and when I want to evaluate the model. Webcam opened and closd at the same time with the following error message:

line 32, in segment_hand 
image, contours, hierarchy = cv2.findContours(thresholded.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)....

ValueError: not enough values to unpack (expected 3, got 2)"

Can anyone please help me how can I overcome the problem with all my thanks.

Regard..

CodePudding user response:

Can you try the following approach? https://github.com/facebookresearch/maskrcnn-benchmark/issues/339

CodePudding user response:

From cv2.findContours only returns 2 values not 3. Check the documentation

So you can change your code like this,

contours, hierarchy = cv2.findContours(thresholded.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
  • Related