最近、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;}
何が間違っている可能性がありますか?