Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
490 views
in Technique[技术] by (71.8m points)

c - cvCreateCameraCapture returns null

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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
";
    return -1;
}

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...