【发布时间】:2021-05-12 14:51:47
【问题描述】:
我正在使用英特尔实感 L515。我想在两个不同的 numpy 数组中对齐深度和彩色图像,使它们的分辨率相同。
这是我的代码
import pyrealsense2 as rs
import numpy as np
pc = rs.pointcloud()
pipe = rs.pipeline()
config = rs.config()
config.enable_stream(rs.stream.depth, 640, 480, rs.format.z16, 30)
config.enable_stream(rs.stream.color, 960, 540, rs.format.bgr8, 30)
pipe.start(config)
try:
frames = pipe.wait_for_frames()
depth = frames.get_depth_frame()
color = frames.get_color_frame()
# These are the two different frames to align
depth_image = np.asanyarray(depth.get_data())
color_image = np.asanyarray(color.get_data())
# The new color image
# color_image_with_same_resolution = ?
finally:
pipe.stop()
彩色图像比深度图像具有更高的分辨率。什么是调整彩色图像大小的最有效方法,使其具有与深度图像相同的尺寸,并且每个颜色像素都映射到正确的对应深度像素。在这种情况下,速度和效率至关重要。
本质上,我希望能够保存两个单独的数组,以便在另一个程序中使用。数组必须具有相同的维度,如下所示:(Z - Array 640x480x1) 和 (RGB -Array 640x480x3)
【问题讨论】:
-
打电话给resize怎么样?
-
我希望有一种方法可以使用 librealsense 模块。现在我刚刚使用 opencv 来调整图像大小。不确定这是否是最好的解决方案,但现在必须这样做。