Python bindings for Intel RealSense SDK 2.0 providing access to depth and color cameras for computer vision applications.
—
Advanced camera control interface for RS400 series cameras, providing fine-grained access to depth processing parameters, color controls, and advanced calibration features. Advanced mode enables deep customization of camera behavior for specialized applications.
Main interface for enabling and configuring advanced mode on compatible devices.
class rs400_advanced_mode:
def toggle_advanced_mode(enable):
"""
Enable or disable advanced mode.
Args:
enable (bool): True to enable advanced mode
"""
def is_enabled() -> bool:
"""
Check if advanced mode is currently enabled.
Returns:
bool: True if advanced mode is active
"""
def serialize_json() -> str:
"""
Export all advanced mode settings as JSON.
Returns:
str: JSON string containing all settings
"""
def load_json(json_content):
"""
Load advanced mode settings from JSON.
Args:
json_content (str): JSON string with settings
"""Fine-grained depth processing parameter control.
class STDepthControlGroup:
# Depth processing parameters
plusIncrement: int
minusIncrement: int
deepSeaMedianThreshold: int
scoreThreshA: int
scoreThreshB: int
textureDifferenceThreshold: int
textureCountThreshold: int
deepSeaSecondPeakThreshold: int
deepSeaNeighborThreshold: int
lrThreshold: int
def get_depth_control() -> STDepthControlGroup:
"""Get current depth control parameters."""
def set_depth_control(group):
"""
Set depth control parameters.
Args:
group (STDepthControlGroup): Depth control settings
"""Motion-based depth enhancement settings.
class STRsm:
rsmBypass: int
diffThresh: float
sloRauDiffThresh: float
removeThresh: float
def get_rsm() -> STRsm:
"""Get current RSM parameters."""
def set_rsm(rsm):
"""
Set RSM parameters.
Args:
rsm (STRsm): RSM settings
"""Advanced color processing and enhancement parameters.
class STColorControl:
disableSADColor: int
disableRAUColor: int
disableSLORightColor: int
disableSLOLeftColor: int
disableSADNormalize: int
def get_color_control() -> STColorControl:
"""Get current color control parameters."""
def set_color_control(control):
"""
Set color control parameters.
Args:
control (STColorControl): Color control settings
"""Color-based filtering thresholds for depth processing.
class STRauColorThresholdsControl:
rauDiffThresholdRed: int
rauDiffThresholdGreen: int
rauDiffThresholdBlue: int
class STSloColorThresholdsControl:
sloK1Penalty: int
sloK2Penalty: int
sloK1PenaltyMod1: int
sloK2PenaltyMod1: int
sloK1PenaltyMod2: int
sloK2PenaltyMod2: int
def get_rau_color_thresholds_control() -> STRauColorThresholdsControl:
"""Get RAU color threshold parameters."""
def set_rau_color_thresholds_control(control):
"""Set RAU color threshold parameters."""
def get_slo_color_thresholds_control() -> STSloColorThresholdsControl:
"""Get SLO color threshold parameters."""
def set_slo_color_thresholds_control(control):
"""Set SLO color threshold parameters."""Advanced exposure and color temperature controls.
class STAEControl:
meanIntensitySetPoint: int
brightRatio: float
kpGain: float
kiGain: float
def get_ae_control() -> STAEControl:
"""Get auto-exposure control parameters."""
def set_ae_control(control):
"""
Set auto-exposure control parameters.
Args:
control (STAEControl): Auto-exposure settings
"""Depth mapping and census transform parameters.
class STDepthTableControl:
depthUnits: int
depthClampMin: int
depthClampMax: int
disparityMultiplier: int
disparityShift: int
class STCensusRadius:
uRadius: int
vRadius: int
def get_depth_table() -> STDepthTableControl:
"""Get depth table parameters."""
def set_depth_table(table):
"""Set depth table parameters."""
def get_census_radius() -> STCensusRadius:
"""Get census transform radius."""
def set_census_radius(radius):
"""Set census transform radius."""class STRauSupportVectorControl:
minWest: int
minEast: int
minNorth: int
minSouth: int
minNorthEast: int
minSouthEast: int
minNorthWest: int
minSouthWest: int
class STSloPixelControl:
pixel1: int
pixel2: int
pixel3: int
class STHdad:
lambdaCensus: float
lambdaAD: float
ignoreSAD: int
class STColorCorrection:
colorCorrection1: float
colorCorrection2: float
colorCorrection3: float
colorCorrection4: float
colorCorrection5: float
colorCorrection6: float
colorCorrection7: float
colorCorrection8: float
colorCorrection9: float
colorCorrection10: float
colorCorrection11: float
colorCorrection12: float
class STAFactor:
amplitude: float
maxRadius: float
def get_rau_support_vector_control() -> STRauSupportVectorControl:
"""Get RAU support vector parameters."""
def get_color_correction() -> STColorCorrection:
"""Get color correction matrix."""
def get_depth_table() -> STDepthTableControl:
"""Get depth table control parameters."""
def get_ae_control() -> STAEControl:
"""Get auto-exposure control parameters."""
def get_census_radius() -> STCensusRadius:
"""Get census radius parameters."""
def get_depth_control() -> STDepthControlGroup:
"""Get depth control group parameters."""
def get_rsm() -> STRsm:
"""Get RSM parameters."""
def get_rau_color_thresholds_control() -> STRauColorThresholdsControl:
"""Get RAU color thresholds."""
def get_slo_color_thresholds_control() -> STSloColorThresholdsControl:
"""Get SLO color thresholds."""
def get_slo_penalty_control() -> STSloPenaltyControl:
"""Get SLO penalty control parameters."""
def get_hdad() -> STHdad:
"""Get HDAD parameters."""
def get_color_control() -> STColorControl:
"""Get color control parameters."""
def get_depth_table() -> STDepthTableControl:
"""Get depth table parameters."""
def get_auto_exposure_control() -> STAEControl:
"""Get auto-exposure control parameters."""
def get_census_radius() -> STCensusRadius:
"""Get census radius parameters."""For complete settings backup and restore.
class serializable_device:
def serialize_json() -> str:
"""
Export device settings as JSON.
Returns:
str: JSON string with device configuration
"""
def load_json(json_content):
"""
Load device settings from JSON.
Args:
json_content (str): JSON configuration string
"""import pyrealsense2 as rs
# Get advanced mode device
pipeline = rs.pipeline()
profile = pipeline.start()
device = profile.get_device()
# Check if device supports advanced mode
if device.is_valid() and device.supports(rs.camera_info.advanced_mode):
advanced_mode_dev = device.as_rs400_advanced_mode()
# Enable advanced mode
if not advanced_mode_dev.is_enabled():
advanced_mode_dev.toggle_advanced_mode(True)
print("Advanced mode enabled")# Get current depth control settings
depth_control = advanced_mode_dev.get_depth_control()
# Modify settings
depth_control.scoreThreshA = 1
depth_control.scoreThreshB = 2000
depth_control.textureDifferenceThreshold = 1500
depth_control.textureCountThreshold = 6
# Apply new settings
advanced_mode_dev.set_depth_control(depth_control)# Backup current settings
settings_json = advanced_mode_dev.serialize_json()
# Save to file for later use
with open('camera_settings.json', 'w') as f:
f.write(settings_json)
# Restore settings later
with open('camera_settings.json', 'r') as f:
saved_settings = f.read()
advanced_mode_dev.load_json(saved_settings)Install with Tessl CLI
npx tessl i tessl/pypi-pyrealsense2