OpenCV: How to visualize a depth image

前端 未结 4 1417
终归单人心
终归单人心 2020-12-04 10:48

I am using a dataset in which it has images where each pixel is a 16 bit unsigned int storing the depth value of that pixel in mm. I am trying to visualize this as a greysca

4条回答
  •  情书的邮戳
    2020-12-04 11:08

    Adding to samg' answer, you can expand even more the range of your displayed image.

    double min;
    double max;
    cv::minMaxIdx(map, &min, &max);
    cv::Mat adjMap;
    // expand your range to 0..255. Similar to histEq();
    map.convertTo(adjMap,CV_8UC1, 255 / (max-min), -min); 
    
    // this is great. It converts your grayscale image into a tone-mapped one, 
    // much more pleasing for the eye
    // function is found in contrib module, so include contrib.hpp 
    // and link accordingly
    cv::Mat falseColorsMap;
    applyColorMap(adjMap, falseColorsMap, cv::COLORMAP_AUTUMN);
    
    cv::imshow("Out", falseColorsMap);
    

    The result should be something like the one below

    enter image description here

提交回复
热议问题