我有一台Intel Realsense深度相机D415。我尝试使用这种方法将像素从深度通道映射到颜色通道。我使用的是pythonapi,显然pyrealsense2.align()
方法占用大量的CPU资源,它极大地降低了我的应用程序的速度。所以,我在想也许将深度像素映射到彩色像素可以让我更快地运行。但是,我遇到了以下问题:当我试图将深度像素映射到其对应的颜色像素时,我得到的结果是[15294.3466796875,-113.68994140625]。我怀疑这是否正确,因为我的颜色通道分辨率是1280x720,而且我的颜色坐标明显超出了[0,1280],[0,720]。我使用的代码(link)如下:
import pyrealsense2 as rs
pipeline = rs.pipeline()
pipe_profile = pipeline.start()
frames = pipeline.wait_for_frames()
depth_frame = frames.get_depth_frame()
color_frame = frames.get_color_frame()
# Intrinsics & Extrinsics
depth_intrin = depth_frame.profile.as_video_stream_profile().intrinsics
color_intrin = color_frame.profile.as_video_stream_profile().intrinsics
depth_to_color_extrin = depth_frame.profile.get_extrinsics_to(color_frame.profile)
color_to_depth_extrin = color_frame.profile.get_extrinsics_to(depth_frame.profile)
print "\n Depth intrinsics: " + str(depth_intrin)
print "\n Color intrinsics: " + str(color_intrin)
print "\n Depth to color extrinsics: " + str(depth_to_color_extrin)
# Depth scale - units of the values inside a depth frame, i.e how to convert the value to units of 1 meter
depth_sensor = pipe_profile.get_device().first_depth_sensor()
depth_scale = depth_sensor.get_depth_scale()
print depth_scale
# Map depth to color
depth_pixel = [200, 200] # Random pixel
print "\n\t depth_pixel: " + str(depth_pixel)
depth_point = rs.rs2_deproject_pixel_to_point(depth_intrin, depth_pixel, depth_scale)
color_point = rs.rs2_transform_point_to_point(depth_to_color_extrin, depth_point)
color_pixel = rs.rs2_project_point_to_pixel(color_intrin, color_point)
print "\n\t color_pixel: " + str(color_pixel)
pipeline.stop()
此外,以下是打印的内容:
^{pr2}$1.在这种情况下,有人知道变通办法吗?
我还需要进行其他的转变吗? 非常感谢任何帮助/指导。在
目前没有回答
相关问题 更多 >
编程相关推荐