I would like the range for the visual to be )0,16) meters.
I have tried normalizing to 0,255 and converting to CV_8UC1 but that did not seem to work.
This code gives me something close but it’s all black or white:
depth.convertTo(depth, CV_8UC1);
cv::equalizeHist(depth, depth);
cv::imshow(“q”, depth);
cv::waitKey(1);
Yes, I’ve tried normalizing and then applying the jet colormap, but the everything just turns different shades of blue. So the range seems to be incorrect. I tried to fix it by removing outliers so every pixel is in range 0,16 in the depth map. But that did not work either.
//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: