ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
If you just want to visually inspect it, you could scale the value range according to the maximum value:
00436 void depthToCV8UC1(const cv::Mat& float_img, cv::Mat& mono8_img){
00437 //Process images
00438 if(mono8_img.rows != float_img.rows || mono8_img.cols != float_img.cols){
00439 mono8_img = cv::Mat(float_img.size(), CV_8UC1);}
00440 //The following doesn't work if there are NaNs
00441 double minVal, maxVal;
00442 minMaxLoc(float_img, &minVal, &maxVal);
00443 ROS_DEBUG("Minimum/Maximum Depth in current image: %f/%f", minVal, maxVal);
00446 cv::convertScaleAbs(float_img, mono8_img, 100, 0.0);
00447 }