1 | initial version |
I think the simpler is the following: In order to make a mat of type CV_64F
CV_32F
or CV_16U
visualize properly you must normalize it before and then convert it to CV_8U
which is the best case for imshow()
to show it, thought from my experience imshow()
can handle the other types quite nicely as well. In any case the following should do the trick:
cv::Mat depth_src; // your original depth image of type CV_64F, CV_32F or CV_16U
cv::Mat depth_vis; // destination image for visualization
cv::normalize(depth_src, depth_vis, 0, 255, CV_MINMAX);
depth_vis.convertTo(depth_vis, CV_8UC3);
This will transform depth image so that all values are between 0 and 255. Then you just transform it into 8-bit and visualize it.