tags:

views:

36

answers:

4

Hi, I've got a webcam which is working perfectly in vlc, and is available as /dev/video0. However, whenever I use cvCreateCameraCapture, it returns null. I've used 0,1,-1 as indexes. What could be causing the problem? I'm on Ubuntu 9.10 BTW, using openCV 2.1.0.1 ppa.

A: 

What is the make/model of webcam you are using? I have had this problem with a few cheap web cams and one creative labs one, if you let me know what you're using I may be able to help. However the built in camera on my netbook and a PS3 Eye cam work fine.

Diziet
I'm using 2 webcams, one is a Sirius USB webcam. The other one is the inbuilt webcam that came with my laptop (Lenovo Y330).
Could you do the following and let me know. I'm a bit knew to stackoverflow so bare with me! Firstly afaik opencv only supports V4L for USB devices under linux so you need to check they are doing that. I think if you check in /var/log/udev with:grep video /var/log/udevandgrep -i v4l /var/log/udev|grep DEVLINKSand copy back the lines for your camera. Also here's an really basic camera test, I'm sure i'm preaching to the converted but what does it do on your system? Press escape to quit.http://pastebin.com/9n3BJKVaAlso does the camera work in 'Cheese'?
Diziet
A: 

I also used OpenCV on Ubuntu (but from the standard repos). I had very similar issues and the solution I found was to compile OpenCV from source. I activated the --with-v4l option and it worked fine (you may also need some other flags, depending on your needs). If you compile OpenCV on your own, use CMake. There are also makefiles for "normal" make, but they are old.

Steven Mohr
A: 

I have the same problem with cvCreateCameraCapture in Ubuntu 10 and OpenCV 2.1. It has been working for months, now it doesn't. It's the same problem on 2 laptops. (The only thing I did was move to dual monitors on both. Removing them makes no difference.) Re-installing OpenCV using Synaptic Package Manager doesn't help. v4l is working. I will try compiling with CMake.

bernard oliver
A: 

I'm using OpenCV 2.1 on Ubuntu 9.04 and this works fine:

CvCapture* capture = NULL;
if ((capture = cvCaptureFromCAM(-1)) == NULL)
{
    std::cerr << "!!! ERROR: cvCaptureFromCAM No camera found\n";
    return -1;
}

Note that I'm using cvCaptureFromCAM() instead of cvCreateCameraCapture().

karlphillip
@user280454 Did it helped you?
karlphillip