You should use the OpenCV built-in function minMaxLoc
instead of std
function.
Mat m;
//Initialize m
double minVal;
double maxVal;
Point minLoc;
Point maxLoc;
minMaxLoc( m, &minVal, &maxVal, &minLoc, &maxLoc );
cout << "min val: " << minVal << endl;
cout << "max val: " << maxVal << endl;