0

Ubuntu 12.04 LTS で opencv2.4.6.1 を使用しています。私はopencvが初めてで、opencvドキュメントのサンプルプログラムを理解しようとしています. USB ウェブカメラ (Kinamax ナイト ビジョン カメラ) から写真を撮り、その上で画像処理を行うプロジェクトに取り組もうとしています。以下に示すサンプルコードを見つけました。

#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;
}

以下を使用してコンパイルする場合:

g++ trycam.c -o trycam `--cflags --libs opencv`

エラーは発生しません。を使用して実行しようとすると: ./trycam 何も表示されません! 文字通り何もありません。

Google やスタックオーバーフロー コミュニティの他の投稿を検索して、ライブラリを更新し、ffmpeg、GTK、Gstreamer などの他の依存関係をインストールしようとしました。USB 経由で接続した Web カメラは、こちらのリンクの Linux opencv でサポートされている Web カメラのリストに従ってサポートされていないことを理解しています。HP Pavilion dv6000 にあるデフォルトの Web カメラでさえ開きません。

これを回避する方法はありますか?親切に私を助けてください。

4

0 に答える 0