Quantcast
Channel: Programming – Xinyustudio
Viewing all articles
Browse latest Browse all 284

Using Python & OpenCV to control WebCam, black window: problem and troubleshooting in a single code line

$
0
0

I recently involved in a project to capture images with webcam. I soon found that OpenCV seems to be the best solutions to program in Python.

For how to install Python and OpenCV, refer to the link here. However, I found that a black window pops and the captured images does not show up.

opencv

I googled, and a number of solutions do exist, some are funny, but do not work. Finally I found that editing a single line will troubleshoot the problem:

captured

The solution is to “import cv2.cv”, instead of “import cv”, The code shown in http://luugiathuy.com/2011/02/setup-opencv-for-python/ then works like a charm.

opencv2

Cheers and happy coding


Filed under: Programming

Viewing all articles
Browse latest Browse all 284

Trending Articles