//Find automatically the max and the min
double Min, Max;
cv::minMaxLoc(input, &Min, &Max);
int max_int = ceil(Max);
//create a window complete black
cv::Mat win_mat(cv::Size(input.cols, input.rows), CV_8UC3, cv::Scalar(0, 0, 0));
input.convertTo(input, CV_8UC3, 255 / (Max - Min), -255 * Min / (Max - Min));
input.convertTo(input, CV_8UC3);
cv::Mat M;
cv::applyColorMap(input, M, COLORMAP_JET);
I think that will make the colors dispersion better.
Also if you want to change the ground color from JET to any other you can do this:
Mat mask;
inRange(dest, Vec3b(128, 0, 0), Vec3b(128, 0, 0), mask);
M.setTo(Vec3b(255, 255, 255), mask);
imshow(“ColorMap”, M);
waitKey(0);
The example above the blue ground of JET (128, 0 ,0 ) is converted to white.