Ask Your Question
0

Search Minimal Value in Open CV

asked 2017-07-25 21:57:23 -0600

choro gravatar image

Excuse me, is there anyone knows how to search minimal value from this valueimage description

i have tried with minMaxLoc but it didn't work... am I wrong? Or any suggestion? Thank you

edit retag flag offensive close merge delete

Comments

3

"i have tried with minMaxLoc but it didn't work..." please show us your code! Then only we can tell where you were wrong!

Balaji R gravatar imageBalaji R ( 2017-07-26 00:47:12 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
2

answered 2017-07-26 07:42:56 -0600

updated 2017-07-26 09:47:19 -0600

i have tried with minMaxLoc but it didn't work... am I wrong? Or any suggestion? Thank you

Then this means you are using it wrong. I've used it successfuly for that purpose multiple times.

First, you should have a cv::Mat or an std::vector containing the data you need to check.

Lets assume your structure containing the data is cv::Mat distanceData.

Then, to find the minimum value and index, you should use the cv::minMaxLoc as in this example.

    cv::Mat distanceData; //-- This structure contains the distance values
    double min, max;
    cv::Point minLoc, maxLoc;
    cv::minMaxLoc(distanceData, &min, &max, &minLoc, &maxLoc);

min, max, minLoc and maxLoc are actually output arguments that should be entered as pointers, so that the function can change them inside.

After doing this, min and max will contain the minimum and maximum values present in the data structure, and minLoc and maxLoc are cv::Points with the coordinates of such minimum and maximum values.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-07-25 21:57:23 -0600

Seen: 149 times

Last updated: Jul 26 '17