How to accelerate my camera control?
I am working with opencv 2.48 and visual studio 2010. When I add into my code Gaussian filtering and canny edge detection, the time of the image capturing was increased. How can I accelerate this process. If I have to add more functions for image processing and object tracking I thing that the speed for image capturing will be decreased more? I am using uEye camera 1490-M-GL.
Here is my code:
#include <opencv2\core\core.hpp>
#include <opencv2\highgui\highgui.hpp>
#include <opencv2\opencv.hpp>
#include <opencv2\imgproc\imgproc.hpp>
#include <iostream>
using namespace cv;
using namespace std;
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);
cap.set(CV_CAP_PROP_POS_MSEC, 300);
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);
namedWindow("wind1", 0);
namedWindow("wind50", 0);
IplImage* videoFrame = cvCreateImage(cvSize(width, height), IPL_DEPTH_8U, 1);
cout << "W" << width << "FPS" << fps << endl;
Mat gray;
int counter = 0;
while(1)
{
Mat frame;
cap.read(frame);
imshow("wind1", frame);
if (!frame.data) break;
cvtColor(frame, gray, COLOR_BGR2GRAY);
GaussianBlur(gray, gray, Size(7,7), 1.5, 1.5);
Canny(gray, gray, 0, 30, 3);
imshow("wind50", gray);
}
return 0;
}