我有英特尔Realsense深度相机D415。我正在尝试使用这种方法将像素从深度通道映射到颜色通道。我正在使用Python API,显然pyrealsense2.align()
方法非常占用CPU,它会大大减慢我的应用程序速度。所以,我在考虑将深度像素映射到颜色像素可以让我的运行速度更快。但是,我遇到了以下问题:当我尝试将深度像素 [200,200] 映射到其对应的颜色像素时,我返回 [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()
此外,这是印刷品:
Depth intrinsics: width: 1280, height: 720, ppx: 644.664, ppy: 406.596, fx: 965.563, fy: 965.563, model: Brown Conrady, coeffs: [0, 0, 0, 0, 0]
Color intrinsics: width: 640, height: 480, ppx: 330.929, ppy: 233.255, fx: 610.102, fy: 609.615, model: Brown Conrady, coeffs: [0, 0, 0, 0, 0]
Depth to color extrinsics: rotation: [0.99999, 0.00428028, 0.0010846, -0.00427981, 0.999991, -0.000430169, -0.00108643, 0.000425523, 0.999999]
translation: [0.0151529, -0.00012542, -0.000400548]
0.0010000000475
depth_pixel: [200, 200]
color_pixel: [15294.3466796875, -113.68994140625]
1.在这种情况下,是否有人知道解决方法?
2.我还需要进行其他任何转换吗? 非常感谢任何帮助/指导。