double minVal; double maxVal; Point minLoc; Point maxLoc; cv::minMaxLoc(image, &minVal, &maxVal, &minLoc, &maxLoc ); cv2::Mat imageResult = image * 255/maxVal;