pyrealsense2 sensor.get_supported_options()(获取当前sensor支持的参数)
文章目錄
- 獲取當(dāng)前color sensor支持的參數(shù)
- 獲取當(dāng)前depth sensor支持的參數(shù)
- 獲取color_sensor和depth_sensor各自不同的參數(shù)
- 獲取color_sensor和depth_sensor相同的參數(shù)
獲取當(dāng)前color sensor支持的參數(shù)
# -*- coding: utf-8 -*- """ @File : 200109_獲取受支持的參數(shù).py @Time : 2020/1/9 8:59 @Author : Dontla @Email : sxana@qq.com @Software: PyCharm """ import time import numpy as np import pyrealsense2 as rs import cv2ctx = rs.context()pipeline = rs.pipeline(ctx) cfg = rs.config() cfg.enable_device('838212073161') cfg.enable_stream(rs.stream.depth, 640, 360, rs.format.z16, 30) cfg.enable_stream(rs.stream.color, 640, 360, rs.format.bgr8, 30) pipeline_profile = pipeline.start(cfg)# [0]是獲取depth_sesor,[1]是獲取color_sensor sensor = pipeline.get_active_profile().get_device().query_sensors()[1]print(sensor.get_supported_options())結(jié)果:
[option.backlight_compensation, option.brightness, option.contrast, option.exposure, option.gain, option.gamma, option.hue, option.saturation, option.sharpness, option.white_balance, option.enable_auto_exposure, option.enable_auto_white_balance, option.frames_queue_size, option.power_line_frequency, option.auto_exposure_priority, option.global_time_enabled]
獲取當(dāng)前depth sensor支持的參數(shù)
代碼同上,除下句之外
sensor = pipeline.get_active_profile().get_device().query_sensors()[0][option.exposure, option.gain, option.enable_auto_exposure, option.visual_preset, option.laser_power, option.emitter_enabled, option.frames_queue_size, option.asic_temperature, option.error_polling_enabled, option.projector_temperature, option.output_trigger_enabled, option.depth_units, option.stereo_baseline, option.inter_cam_sync_mode, option.emitter_on_off, option.global_time_enabled]
獲取color_sensor和depth_sensor各自不同的參數(shù)
寫了個(gè)簡(jiǎn)單的代碼,獲取color_sensor和depth_sensor各自不同的參數(shù):
color_frame_options = ['option.backlight_compensation','option.brightness','option.contrast','option.exposure','option.gain','option.gamma','option.hue','option.saturation,''option.sharpness','option.white_balance','option.enable_auto_exposure','option.enable_auto_white_balance','option.frames_queue_size','option.power_line_frequency','option.auto_exposure_priority','option.global_time_enabled']depth_frame_options = ['option.exposure','option.gain', 'option.enable_auto_exposure', 'option.visual_preset', 'option.laser_power','option.emitter_enabled', 'option.frames_queue_size', 'option.asic_temperature','option.error_polling_enabled', 'option.projector_temperature', 'option.output_trigger_enabled','option.depth_units', 'option.stereo_baseline', 'option.inter_cam_sync_mode','option.emitter_on_off', 'option.global_time_enabled']color_different_options = [] depth_different_options = []for i in color_frame_options:flag = Falsefor j in depth_frame_options:if i == j:flag = Truebreakif not flag:color_different_options.append(i)for i in depth_frame_options:flag = Falsefor j in color_frame_options:if i == j:flag = Truebreakif not flag:depth_different_options.append(i)print(color_different_options)print(depth_different_options)結(jié)果:
color_different_options:[‘option.backlight_compensation’, ‘option.brightness’, ‘option.contrast’, ‘option.gamma’, ‘option.hue’, ‘option.saturation,option.sharpness’, ‘option.white_balance’, ‘option.enable_auto_white_balance’, ‘option.power_line_frequency’, ‘option.auto_exposure_priority’]
depth_different_options:[‘option.visual_preset’, ‘option.laser_power’, ‘option.emitter_enabled’, ‘option.asic_temperature’, ‘option.error_polling_enabled’, ‘option.projector_temperature’, ‘option.output_trigger_enabled’, ‘option.depth_units’, ‘option.stereo_baseline’, ‘option.inter_cam_sync_mode’, ‘option.emitter_on_off’]
獲取color_sensor和depth_sensor相同的參數(shù)
color_frame_options = ['option.backlight_compensation','option.brightness','option.contrast','option.exposure','option.gain','option.gamma','option.hue','option.saturation,''option.sharpness','option.white_balance','option.enable_auto_exposure','option.enable_auto_white_balance','option.frames_queue_size','option.power_line_frequency','option.auto_exposure_priority','option.global_time_enabled']depth_frame_options = ['option.exposure','option.gain', 'option.enable_auto_exposure', 'option.visual_preset', 'option.laser_power','option.emitter_enabled', 'option.frames_queue_size', 'option.asic_temperature','option.error_polling_enabled', 'option.projector_temperature', 'option.output_trigger_enabled','option.depth_units', 'option.stereo_baseline', 'option.inter_cam_sync_mode','option.emitter_on_off', 'option.global_time_enabled']equal_options = [] for i in color_frame_options:for j in depth_frame_options:if i == j:equal_options.append(i)print('equal_options:{}'.format(equal_options)) # equal_options:['option.exposure', 'option.gain', 'option.enable_auto_exposure', 'option.frames_queue_size', 'option.global_time_enabled']結(jié)果:
equal_options:[‘option.exposure’, ‘option.gain’, ‘option.enable_auto_exposure’, ‘option.frames_queue_size’, ‘option.global_time_enabled’]
參考文章:Intel Realsense D435 pyrealsense2 options類
總結(jié)
以上是生活随笔為你收集整理的pyrealsense2 sensor.get_supported_options()(获取当前sensor支持的参数)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: Intel Realsense D435
- 下一篇: Intel Realsense D435