相关疑难解决方法(0)

OpenCV:如何可视化深度图像

我正在使用一个数据集,其中包含图像,其中每个像素是一个16位无符号int,以mm为单位存储该像素的深度值.我试图通过执行以下操作将其可视化为灰度深度图像:

cv::Mat depthImage; 
depthImage = cv::imread("coffee_mug_1_1_1_depthcrop.png", CV_LOAD_IMAGE_ANYDEPTH | CV_LOAD_IMAGE_ANYCOLOR ); // Read the file 
depthImage.convertTo(depthImage, CV_32F); // convert the image data to float type   
namedWindow("window");
float max = 0;
for(int i = 0; i < depthImage.rows; i++){
    for(int j = 0; j < depthImage.cols; j++){
        if(depthImage.at<float>(i,j) > max){
            max = depthImage.at<float>(i,j);
        }
    }   
}
cout << max << endl;


float divisor = max / 255.0;
cout << divisor << endl;
for(int i = 0; i < depthImage.rows; i++){
    for(int j …
Run Code Online (Sandbox Code Playgroud)

c++ opencv visualization depth kinect

22
推荐指数
2
解决办法
6万
查看次数

标签 统计

c++ ×1

depth ×1

kinect ×1

opencv ×1

visualization ×1