我正在尝试在 Ubuntu 12.04 LTS 上使用 openCV 2.4.3 执行以下程序。但是我得到“相机未初始化为输出”有人可以帮助我吗?
这是代码:
include <iostream>
include "opencv2/imgproc/imgproc.hpp"
include "opencv2/highgui/highgui.hpp"
using namespace cv;
using namespace std;
int main()
{
VideoCapture cap(1);
if (!cap.isOpened())
{
cout <<"Failed to initialize camera\n";
return 1;
}
namedWindow("CameraCapture");
Mat frame;
while (1)
{
cap>> frame;
imshow("cameraCapture",frame);
if (waitKey(30)>0)break;
}
destroyAllWindows();
return 0;
}
请帮我!
谢谢,库沙尔