I use OpenNI and OpenCV (but without the latest code with openni support). If I just send the depth channel to the screen, it will look dark and it's hard to understand something. Therefore, I want to show the depth channel to the user in color, but I canβt find how to do this without losing accuracy. Now I do it like this:
xn::DepthMetaData xDepthMap; depthGen.GetMetaData(xDepthMap); XnDepthPixel* depthData = const_cast<XnDepthPixel*>(xDepthMap.Data()); cv::Mat depth(frame_height, frame_width, CV_16U, reinterpret_cast<void*>(depthData)); cv::Mat depthMat8UC1; depth.convertTo(depthMat8UC1, CV_8UC1); cv::Mat falseColorsMap; cv::applyColorMap(depthMat8UC1, falseColorsMap, cv::COLORMAP_AUTUMN); depthWriter << falseColorsMap;
But in this case, I get worse (lose details) than, for example, kinects software for windows shows. Therefore, I am looking for a function in OpenNI or OpenCV with better conversion.
source share