Недавно я переустановил Ubuntu - 12.04. Я использую веб-камеру для видео для программы в OpenCV. Это не работает для моей веб-камеры, но тот же кусок кода работает для моего друга. Моя веб-камера работает с сыром. Кусок кода, который я использую:
#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;}
Что может быть неправильным?
v4l2 или v4l может отсутствовать, пожалуйста, проверьте свою производительность. Это должно быть проблемой highgui.