Ask Your Question
0

Opencv How to find the highest Intensity?

asked 2014-02-04 11:10:48 -0500

tiho_bg gravatar image

updated 2014-02-05 03:15:19 -0500

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;
}
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2014-02-04 11:22:06 -0500

mark_vision gravatar image

if I understand what are you asking, try the minMaxLoc function

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

Stats

Asked: 2014-02-04 11:10:48 -0500

Seen: 138 times

Last updated: Feb 05 '14