creotiv / object_detection_projects

My public projects about object detection algorithms
347 stars 225 forks source link

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

Closed nikogamulin closed 3 years ago

nikogamulin commented 5 years ago

I cloned the repo and when I tried to run traffic.py got the following error:

Training BG Subtractor...
Traceback (most recent call last):
  File "traffic.py", line 115, in <module>
    main()
  File "traffic.py", line 104, in main
    pipeline.run()
  File "/home/niko/workspace/object_detection_projects/opencv_traffic_counting/pipeline.py", line 59, in run
    self.context = p(self.context)
  File "/home/niko/workspace/object_detection_projects/opencv_traffic_counting/pipeline.py", line 151, in __call__
    context['objects'] = self.detect_vehicles(fg_mask, context)
  File "/home/niko/workspace/object_detection_projects/opencv_traffic_counting/pipeline.py", line 122, in detect_vehicles
    fg_mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_TC89_L1)
ValueError: not enough values to unpack (expected 3, got 2)
Fredtoby commented 5 years ago

I have the same problem, how did you solve it?

nikogamulin commented 5 years ago

@zhenningli I have not solved it.

Naveennavik commented 3 years ago

Same problem Continues have you guys solved the issue? @zhenningli @nikogamulin @creotiv

creotiv commented 3 years ago

That problem arise if you use newer version of OpenCV, where function findCountours returns 2 values instead of 3: https://docs.opencv.org/master/d3/dc0/group__imgproc__shape.html#gadf1ad6a0b82947fa1fe3c3d497f260e0

If you use newer version the remove image variable returned from function.