Opencv nie może uzyskać dostępu do mojej kamery internetowej

Mam problem z dostępem do kamery za pomocą opencv 2.4.3.

Mój system:

Hp Probook 4530s - Kamera internetowa HP Fixed HD

Ubuntu 12.10

OpenCV 2.4.3

Jeśli chcę przechwycić wbudowaną kamerę, otrzymuję BŁĄD: przechwytywanie jest NULL

używamhttp://opencv.willowgarage.com/wiki/CameraCapture przykładowy kod.

Przykładowy kod to:

#include "cv.h" 
#include "highgui.h" 
#include <stdio.h>  
// A Simple Camera Capture Framework 
int main() {
CvCapture* capture = cvCaptureFromCAM( CV_CAP_ANY );
if ( !capture ) {
 fprintf( stderr, "ERROR: capture is NULL \n" );
 getchar();
 return -1;
}
// Create a window in which the captured images will be presented
cvNamedWindow( "mywindow", CV_WINDOW_AUTOSIZE );
// Show the image captured from the camera in the window and repeat
while ( 1 ) {
 // Get one frame
 IplImage* frame = cvQueryFrame( capture );
 if ( !frame ) {
   fprintf( stderr, "ERROR: frame is null...\n" );
   getchar();
   break;
 }
 cvShowImage( "mywindow", frame );
 // Do not release the frame!
 //If ESC key pressed, Key=0x10001B under OpenCV 0.9.7(linux version),
 //remove higher bits using AND operator
 if ( (cvWaitKey(10) & 255) == 27 ) break;
}
// Release the capture device housekeeping
cvReleaseCapture( &capture );
cvDestroyWindow( "mywindow" );
return 0;
}

Próbowałem też zxawtv -hwscan przy użyciu terminalu do pisania. Dostaję to wyjście:

looking for available devices
port 129-144

type : Xvideo, image scaler
name : Intel(R) Textured Video`


/dev/video0: OK    
             [ -device /dev/video0 ]
type : libv4l

name : HP HD Webcam [Fixed]

flags:  capture

wtedy mogę uzyskać dostęp do wpisywania mojej kameryxawtv video0. Myślę, że nie mam problemów z moją kamerą internetową. Mam problem z opencv.

questionAnswers(3)

yourAnswerToTheQuestion