1、
source_rgbd_image= cv2.imread("./dataset/016/image/image00001.png")
source_rgbd_image1=o3d.io.read_image("./dataset/016/image/image00001.png")
color_cv_s = np.asarray(source_rgbd_image)
此时source_rgbd_image和color_cv_s应该都是numpy的数组,但cv2读入的是BGR顺序,color_cv_s是RGB顺序。
2、
source_rgbd_image= cv2.imread("./dataset/016/image/image00001.png")
target_rgbd_image = cv2.imread("./dataset/016/depth/depth00001.png")
source_rgbd_image1=o3d.io.read_image("./dataset/016/depth/depth00001.png")
target_rgbd_image1 =o3d.io.read_image("./dataset/016/image/image00001.png")
color_cv_s = np.asarray(source_rgbd_image1)
color_cv_t = np.asarray(target_rgbd_image1)
#color_cv_s = np.asarray(source_rgbd_image1)
#print(color_cv_s)
print(source_rgbd_image.ndim)
print(source_rgbd_image.shape)
print(source_rgbd_image.dtype)
print(source_rgbd_image.itemsize)
print(target_rgbd_image.ndim)
print(target_rgbd_image.shape)
print(target_rgbd_image.dtype)
print(target_rgbd_image.itemsize)
print(color_cv_s.ndim)
print(color_cv_s.shape)
print(color_cv_s.dtype)
print(color_cv_s.itemsize)
print(color_cv_t.ndim)
print(color_cv_t.shape)
print(color_cv_t.dtype)
print(color_cv_t.itemsize)
输出
source_rgbd_image= cv2.imread("./dataset/016/image/image00001.png")
target_rgbd_image = cv2.imread("./dataset/016/depth/depth00001.png")
color=o3d.io.read_image("./dataset/016/image/image00001.png")
depth=o3d.io.read_image("./dataset/016/depth/depth00001.png")
rgbd_image = o3d.geometry.RGBDImage.create_from_color_and_depth(
color,
depth,
depth_trunc=3.0,
convert_rgb_to_intensity=False)
color_cv_c = np.asarray(rgbd_image.color)
color_cv_d = np.asarray(rgbd_image.depth)
print(source_rgbd_image.ndim)
print(source_rgbd_image.shape)
print(source_rgbd_image.dtype)
print(source_rgbd_image.itemsize)
print(target_rgbd_image.ndim)
print(target_rgbd_image.shape)
print(target_rgbd_image.dtype)
print(target_rgbd_image.itemsize)
print(color_cv_c.ndim)
print(color_cv_c.shape)
print(color_cv_c.dtype)
print(color_cv_c.itemsize)
print(color_cv_d.ndim)
print(color_cv_d.shape)
print(color_cv_d.dtype)
print(color_cv_d.itemsize)
输出
如果convert_rgb_to_intensity=True