0

最近、Ubuntu 12.04 を再インストールしました。OpenCVでプログラムのビデオを撮るためにウェブカメラを使用しています。私のウェブカメラでは機能しませんが、同じコードが私の友人では機能します。私のウェブカメラは Cheese で動作します。私が使用しているコードは次のとおりです。

#include "opencv2/highgui/highgui.hpp"
#include "opencv2/core/core.hpp"
#include "opencv2/imgproc/imgproc_c.h"
#include <opencv2/imgproc/imgproc.hpp>
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define heightBirdEyeView 1000
#define widthBirdEyeView 1000   //earlier was 300 300
#define _USE_MATH_DEFINES

//public class VideoCapture;
using namespace cv;         
using namespace std;

int main(int argc, char** argv)
{
VideoCapture cap(0); // open the default camera

if(!cap.isOpened())
{ // check if we succeeded
cout<<"cam not open"<<endl;
return -1;}

 cout<<"yay"<<endl;

Mat frame;
while(1)
{
cap >> frame; 

imshow("frame", frame);

if(waitKey(30) >= 27) 
break;
}

return 0;}

何が間違っている可能性がありますか?

4

1 に答える 1

0

v4l2 または v4l が欠落している可能性があります。make の出力を確認してください。highgui に問題があるはずです。

于 2013-10-20T20:32:00.107 に答える