cv::Mat m; //Initialize m double minVal; double maxVal; Point minLoc; Point maxLoc; cv::minMaxLoc( m, &minVal, &maxVal, &minLoc, &maxLoc ); std::cout << "min val: " << minVal << std::endl; std::cout << "max val: " << maxVal << std::endl;