Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
peerawit503 opened this issue Jan 17, 2019 · 2 comments
Closed

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

peerawit503 opened this issue Jan 17, 2019 · 2 comments

Comments

@peerawit503
Copy link

I try to run your project
but it can not be run

So this is an error

$ python3 main.py --videos videos
/Users/teamzoon/Downloads/Human-detection-and-Tracking-master/videos/6.mp4*.mp4
['/Users/teamzoon/Downloads/Human-detection-and-Tracking-master/videos/6.mp4']
(360, 640, 3)
(360, 640, 3)
Traceback (most recent call last):
File "main.py", line 160, in
temp = background_subtraction(previous_frame, frame_resized_grayscale, min_area)
File "main.py", line 118, in background_subtraction
im2, cnts, hierarchy = cv2.findContours(thresh.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
ValueError: not enough values to unpack (expected 3, got 2)

@prsntmaurya
Copy link
Member

prsntmaurya commented Jan 18, 2019

Can you specify the version of OpenCV used by you?
It seems that you are getting the error because the function cv2.findContours is returning only two values instead of three values.
A possible cause will be you are using OpenCV version less than 3.0.

A possible solution is to remove the variable im2 at line no. 118, the change is given below:
im2, cnts, hierarchy = cv2.findContours(thresh.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE) ---> current line
cnts, hierarchy = cv2.findContours(thresh.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE) ---> changed line

@peerawit503
Copy link
Author

it's work thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants