dwalton76 / rubiks-cube-tracker

Given an image of a rubiks cube, find the RGB value for each square.
MIT License
129 stars 36 forks source link

Webcam issues #1

Closed manuelmorgado closed 6 years ago

manuelmorgado commented 6 years ago

Hi dwalton!

I was trying your codes :) but I got some errors with the cube's tracker, looks like it is not getting access to the webcam? here the error log...

> Traceback (most recent call last):
>   File "rubiks-cube-tracker.py", line 48, in <module>
>     rvid.analyze_webcam()
>   File "/Users/Manuel/miniconda2/lib/python2.7/site-packages/rubikscubetracker/__init__.py", line 1632, in analyze_webcam
>     if self.analyze(webcam=True):
>   File "/Users/Manuel/miniconda2/lib/python2.7/site-packages/rubikscubetracker/__init__.py", line 1261, in analyze
>     (_, contours, hierarchy) = cv2.findContours(dilated.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
> ValueError: need more than 2 values to unpack
> Cleaned up camera.

Any idea? Thanks! Cheers,

BTW, very nice blog ;)

dwalton76 commented 6 years ago

Hey @manuelmorgado, what version of OpenCV do you have installed? Certian version of findContours return three things while others return two. Can you try changing that line to

(contours, hierarchy) = cv2.findContours(dilated.copy(), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)

and let me know if that works

manuelmorgado commented 6 years ago

Hi @dwalton76! Thanks for reply, the OpenCV version installed in my computer is '2.4.8'. But you are right! the issue of line 1261 in the init.py was fixed with that line :D

I will let you know if I have some more feedback on this code.

Cheers,