pyskell / slouchy

Slouchy uses your webcam to check if you're slouching and alert you if you are.
GNU General Public License v3.0
800 stars 47 forks source link

Ubuntu 14.04 + Mint 17.1 - Needs python-opencv package installed #5

Closed 13rac1 closed 8 years ago

13rac1 commented 8 years ago

The pip cv2 package doesn't contain a working opencv installation for Ubuntu 14.04 + Mint 17.1. Not sure about other OSs.

Installing the apt-get package makes this program run.

sudo apt-get install python-opencv
pyskell commented 8 years ago

Thank you.

Will add this to the README On Oct 12, 2015 8:46 PM, "Brad Erickson" notifications@github.com wrote:

The pip cv2 package doesn't contain a working opencv installation for Ubuntu 14.04 + Mint 17.1. Not sure about other OSs.

Installing the apt-get package makes this program run.

sudo apt-get install python-opencv

— Reply to this email directly or view it on GitHub https://github.com/pyskell/slouchy/issues/5.

13rac1 commented 8 years ago

I've run into the super common: https://bugs.launchpad.net/ubuntu/+source/cheese/+bug/1295247

I suggest recommending the above package, then if that doesn't work, compiling OpenCV from source: http://docs.opencv.org/doc/tutorials/introduction/linux_install/linux_install.html I was able to get a far more detailed error message from OpenCV 3.0:

$ python slouchy.py 
VIDEOIO ERROR: V4L/V4L2: VIDIOC_S_CROP
"sni-qt/24493" WARN  19:20:08.782 void StatusNotifierItemFactory::connectToSnw() Invalid interface to SNW_SERVICE 
VIDEOIO ERROR: V4L2: Pixel format of incoming image is unsupported by OpenCV
Unable to stop the stream.: Bad file descriptor

Either way, this the same issue I've experienced before with an unsupported pixel format for my webcam. None of the different options for libv4lfix the problem.

dgrant commented 8 years ago

I'm not seeing this in the README. Why did you close it eosrei?

dgrant commented 8 years ago

Also needs opencv-data installed for the /usr/share/opencv/haarcascades/haarcascade_frontalface_default.xml file. Please re-open.

13rac1 commented 8 years ago

I closed because while it makes the program run, it does not make it functional on my system therefore I cannot claim it is a valid solution.

My webcam is unsupported by the libraries required by OpenCV, same issue I have with Cheese (at greater than 640x480) and Google Hangouts in Chrome. If everything works for your system, please open a new issue with the full steps to reproduce. I made sure to link the Launchpad bug and show all errors for the significant number of people who will encounter this problem.

I cannot say much about the XML file, but I doubt it needs to be outside the repo.

pyskell commented 8 years ago

@eosrei Are you saying your camera works when run at 640x480? If so we may be able to force OpenCV to grab images at a specific resolution. Not sure though, I'd need to look at the docs. 640x480 is a high enough resolution for face detection.

@dgrant For the haarcascade issue I changed the config to use the local repo copy so everyone has a copy even if they're missing opencv-data. Please let me know if this resolves your issue. If not see if there's anything in issue #1. If not please open a new ticket :)

13rac1 commented 8 years ago

Yes, the camera works in applications that allow the resolution to be selected. Cheese works at 640x480, but displays a black screen and throws errors at 1280x720. It's just as described on that Launchpad issue. Slouchy may function if the resolution is reduced.