2

I am trying to capture from a Sony Handicam DCR-HC38, running the code below, and passing [-1 .. 3] to the CaptureFromCAM function. The code runs, but I get no image. Do I need to "wrap" the camera somehow? Skype recognizes the camera, but python/opencv won't. I'm running Windows Vista if that helps any.

import cv

cv.NamedWindow("camera", 1)

capture = cv.CaptureFromCAM(-1)

while True:
    img = cv.QueryFrame(capture)
    cv.ShowImage("camera", img)
    if cv.WaitKey(10) == 27:
        break
1
  • img = cv.QueryFrame(capture) needs to be tested for if img actually has a value or is None. Commented May 7, 2011 at 18:34

2 Answers 2

3

try increasing the delay on the cv.WaitKey

Sign up to request clarification or add additional context in comments.

Comments

3

not sure if you fixed it or not. But the solution I figured out is by checking which driver OpenCv is trying to access... I have both v4l1 and v4l2, however I can only access device /dev/video0 by using gstreamer codec and the v4l2 driver on my lenovo x200 (internal webcam) using ubuntu 10.10. So I had to recompile Opencv from source, by firstly applying the patch found at:

Opencv-2.0.0.link.v4l2.patch

extract the patch to your opencv root directory: then open terminal and cd to the opencv root directory, and do the following:

patch -p0 <OpenCV-2.0.0-link-v4l2.patch

then:

make
make install

Now your opencv libraries should access the v4l2 driver instead, hope this helps someone

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.