Ask Your Question

Revision history [back]

The documentation gives no information about their difference.

Or you have just not seen the explanation in the documentation and it's your fault...

The docu is e.g. here: http://docs.opencv.org/modules/core/doc/operations_on_arrays.html#minmaxidx

For minmaxloc:

minLoc – pointer to the returned minimum location (in 2D case);

for minmaxIdx:

pointer to the returned minimum location (in nD case);

You use MinMaxLoc if you have simple 2d-Array (e.g. a CV_8UC1 image) and MinMaxIdx if you have more dimensions.

The * "The documentation gives no information about their difference.difference." *

Or you have just not seen the explanation in the documentation and it's your fault...

The docu is e.g. here: http://docs.opencv.org/modules/core/doc/operations_on_arrays.html#minmaxidx

For minmaxloc:

minLoc – pointer to the returned minimum location (in 2D case);

for minmaxIdx:

pointer to the returned minimum location (in nD case);

You use MinMaxLoc if you have simple 2d-Array (e.g. a CV_8UC1 image) and MinMaxIdx if you have more dimensions.

* "The documentation gives no information about their difference." *

Or you have just not seen the explanation in the documentation and it's your fault...

The docu is e.g. here: http://docs.opencv.org/modules/core/doc/operations_on_arrays.html#minmaxidx

For minmaxloc:

minLoc – pointer to the returned minimum location (in 2D case);

for minmaxIdx:

pointer to the returned minimum location (in nD case);

You use MinMaxLoc if you have simple 2d-Array (e.g. a CV_8UC1 image) and MinMaxIdx if you have more dimensions.

cv::Mat foo1(3,3,CV_8UC1);

foo1.setTo(1);
foo1.at<uchar>(1,1) = 2;

double a,b;
cv::Point p1,p2;

cv::minMaxLoc(foo1,&a,&b,&p1,&p2);

// 1 2 [0, 0] [1, 1]
cout << a << " " << b << " " << p1 << " " << p2 << endl;


int arr[3] = {4,3,2};
Mat foo2(3, arr, CV_8UC(1));

foo2.setTo(0);
foo2.at<uchar>(2,1,0) = 2;


int minInd[3];
int maxInd[3];
cv::minMaxIdx(foo2, &a, &b, minInd, maxInd, Mat());

// 0 2 [0 0 0] [2 1 0]
cout << a << " " << b << " [" << minInd[0] << " " << minInd[1] << " " << minInd[2] << "] [" << maxInd[0] << " " << maxInd[1] << " " << maxInd[2] << "]" << endl;

* "The documentation gives no information about their difference." *

Or you have just not seen the explanation in the documentation and it's your fault...

The docu is e.g. here: http://docs.opencv.org/modules/core/doc/operations_on_arrays.html#minmaxidx

For minmaxloc:

minLoc – pointer to the returned minimum location (in 2D case);

for minmaxIdx:

pointer to the returned minimum location (in nD case);

You use MinMaxLoc if you have simple 2d-Array (e.g. a CV_8UC1 image) and MinMaxIdx if you have more dimensions.

cv::Mat foo1(3,3,CV_8UC1);

foo1.setTo(1);
foo1.at<uchar>(1,1) = 2;

double a,b;
cv::Point p1,p2;

cv::minMaxLoc(foo1,&a,&b,&p1,&p2);

// 1 2 [0, 0] [1, 1]
cout << a << " " << b << " " << p1 << " " << p2 << endl;


int arr[3] = {4,3,2};
Mat foo2(3, arr, CV_8UC(1));
CV_8UC1);

foo2.setTo(0);
foo2.at<uchar>(2,1,0) = 2;


int minInd[3];
int maxInd[3];
cv::minMaxIdx(foo2, &a, &b, minInd, maxInd, Mat());

// 0 2 [0 0 0] [2 1 0]
cout << a << " " << b << " [" << minInd[0] << " " << minInd[1] << " " << minInd[2] << "] [" << maxInd[0] << " " << maxInd[1] << " " << maxInd[2] << "]" << endl;