I am working with opencv 2.48 and visual studio 2010. I would like to find the highest intensity of the image moving the camera back and fourth. Could you please give me an advise? 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; }
namedWindow("wind1", 0);
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);
IplImage* videoFrame = cvCreateImage(cvSize(width, height), IPL_DEPTH_8U, 1);
cout << "W" << width << "FPS" << fps << endl;
Mat frame, gray;
while(1)
{
cap.read(frame);
if (!frame.data) break;
cvtColor(frame, gray, COLOR_BGR2GRAY);
threshold(frame, gray, 100,255,CV_THRESH_BINARY_INV);
imshow("wind1", gray);
int key = cvWaitKey(10);
if (key == 27) break;
cout << "imshow" << endl;
}
return 0;
}