赞
踩
在存储32CF1格式的深度图像时,怎么也存储不对
python
和c++
的opencv库中都能实现pip install Pillow
#为了防止和rosmsg的Image重复
from PIL import Image as PILImage
# 存储
depth_image = bridge.imgmsg_to_cv2(data, "32FC1")
depth_name = "depth.tiff"
depth_tiff = PILImage.fromarray(depth_image)
depth_tiff.save(depth_name)
#读取
with PILImage.open("depth.tiff") as img:
print(img.getpixel((20,20)))
//存储
// 读取
string depth_path1 = "/home/tju/catkin_ws_multi_vins/scripts/data/pic_vins_pose/iris_0/images/1713792937.82_depth.tiff";
Mat depth1 = imread ( depth_path1, IMREAD_UNCHANGED );
cout << "depth_size " << depth1.cols << " " << depth1.rows <<endl;
float depth_value = depth1.at<float>(20, 20);
cout << "depth value " << depth_value << endl;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。