I am working with opencv 2.48, visual studio 2010 C++ and a professional camera UI-1490SE (uEye camera). I have realised that opencv is working better with normal web-cams but with professional cameras it is necessary to make all settings first. I would like to start live streaming of the camera using opencv but it is something wrong in my code. I think that I can't capture frames of the camera. The screen is black all the time. Here it is:
include <opencv2\core\core.hpp>
include <opencv2\highgui\highgui.hpp>
include <opencv2\opencv.hpp>
include <opencv2\imgproc\imgproc.hpp>
include <iostream>
using namespace cv;
int main () { VideoCapture cap(0); cap.open(0); if (false) {return -1;}
cap.set(CV_CAP_PROP_FRAME_WIDTH, 3840); cap.set(CV_CAP_PROP_FRAME_HEIGHT, 2748); cap.set(CV_CAP_PROP_FPS, 30.00);
int width = cap.get(CV_CAP_PROP_FRAME_WIDTH); int height = cap.get(CV_CAP_PROP_FRAME_HEIGHT); double fps = cap.get(CV_CAP_PROP_FPS);
IplImage* videoFrame = cvCreateImage(cvSize(width, height), IPL_DEPTH_8U, 1); cvNamedWindow("wind");
Mat frame; while(1) { frame = videoFrame; cap.read(frame);
if(!frame.data) break;
imshow("wind", frame);
if (waitKey(30) == 27)
{
cout << "esc key:" << endl;
break;
}
} cvReleaseImage(&videoFrame); cvDestroyWindow("wind"); return 0; }