深度图一般不能直接查看,需要用代码进行查看,运行下面的代码可以进行查看图像深度图的可视化图像。
import os
import numpy as np
import tifffile as tiff
import matplotlib.pyplot as plt
# 设置数据集路径
dataset_path = '/home/mwl/IEEE_DFC2023-main/workspace'
# 获取数据集中文件名含有 "tif" 的图像文件列表
depth_images = [filename for filename in os.listdir(dataset_path) if filename.endswith('.tif')]
# 遍历处理每个深度真值图像文件
for depth_image_file in depth_images:
depth_image_path = os.path.join(dataset_path, depth_image_file)
# 读取深度真值图像
depth_image = tiff.imread(depth_image_path)
# 可视化深度真值图像
plt.imshow(depth_image, cmap='viridis') # 使用 'viridis' 色图
plt.title(f"Depth Image: {depth_image_file}")
plt.colorbar() # 添加颜色条
plt.show()