Ask Your Question

Revision history [back]

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 Just use it as I'm doing in the example bellow, and you'll get your result.

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 a pointer, 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.

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 Just use it as I'm doing in the example bellow, and you'll get your result.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 a pointer, 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.

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 a pointer, 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.

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.