Pergunta

This question is similar to this one, however in this image I only have a subset of pixels with a valid depth and the rest are set to zero.

For example, here is the rgb:

enter image description here

where all the white pixels have no depth (depth value of 0). If I use the method in the linked question, which is:

double min;
double max;
cv::minMaxIdx(map, &min, &max);
cv::Mat adjMap;
cv::convertScaleAbs(map, adjMap, 255 / max);
cv::imshow("Out", adjMap);

I get the following image, from which it is not very clear to see the depth differences:

enter image description here

The min and max depth values on the object are 601 and 654 respectively.

Foi útil?

Solução

try subtracting the minimum first, then scale to your data range:

double min;
double max;
cv::minMaxIdx(map, &min, &max);
map -= min;
cv::Mat adjMap;
cv::convertScaleAbs(map, adjMap, 255.0 / double(max-min) );
cv::imshow("Out", adjMap);
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top