我看到Intel的示例python代码提供了一种更改分辨率的方法,如下所示:
config.enable_stream(rs.stream.depth, 640, 480, rs.format.z16, 30)
# Start streaming
pipeline.start(config)
https://github.com/IntelRealSense/librealsense/blob/master/wrappers/python/examples/opencv_viewer_example.py
我试图在MATLAB中做如下相同的事情,但得到了一个错误:
config = realsense.config();
config.enable_stream(realsense.stream.depth,1280, 720, realsense.format.z16, 30);
pipeline = realsense.pipeline();
% Start streaming on an arbitrary camera with default settings
profile = pipeline.start(config);
错误如下:
Error using librealsense_mex
Couldn't resolve requests
Error in realsense.pipeline/start (line 31)
out = realsense.librealsense_mex('rs2::pipeline',
'start', this.objectHandle, varargin{1}.objectHandle);
Error in pointcloudRecordCfg (line 15)
profile = pipeline.start(config);
有什么建议吗?
使用它打印可用于可用配置文件的realsense
来自的代码段https://github.com/isl-org/Open3D/blob/master/examples/python/reconstruction_system/sensors/realsense_helper.py
需要pyrealsense2。请参阅中的说明https://github.com/IntelRealSense/librealsense/tree/master/wrappers/python
import pyrealsense2 as rs
def get_profiles():
ctx = rs.context()
devices = ctx.query_devices()
color_profiles = []
depth_profiles = []
for device in devices:
name = device.get_info(rs.camera_info.name)
serial = device.get_info(rs.camera_info.serial_number)
print('Sensor: {}, {}'.format(name, serial))
print('Supported video formats:')
for sensor in device.query_sensors():
for stream_profile in sensor.get_stream_profiles():
stream_type = str(stream_profile.stream_type())
if stream_type in ['stream.color', 'stream.depth']:
v_profile = stream_profile.as_video_stream_profile()
fmt = stream_profile.format()
w, h = v_profile.width(), v_profile.height()
fps = v_profile.fps()
video_type = stream_type.split('.')[-1]
print(' {}: width={}, height={}, fps={}, fmt={}'.format(
video_type, w, h, fps, fmt))
if video_type == 'color':
color_profiles.append((w, h, fps, fmt))
else:
depth_profiles.append((w, h, fps, fmt))
return color_profiles, depth_profiles```
我使用它,它很有效。
config = realsense.config();
config.enable_stream(realsense.stream.depth,640,480,realsense.format.z16,30);
config.enable_stream(realsense.stream.color,640,480,realsense.format.rgb8,30);
% Make Pipeline object to manage streaming
pipe = realsense.pipeline();
% Start streaming with default settings
profile = pipe.start(config);