0
# Advanced Mode API
1
2
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.
3
4
## Capabilities
5
6
### Advanced Mode Control
7
8
Main interface for enabling and configuring advanced mode on compatible devices.
9
10
```python { .api }
11
class rs400_advanced_mode:
12
def toggle_advanced_mode(enable):
13
"""
14
Enable or disable advanced mode.
15
16
Args:
17
enable (bool): True to enable advanced mode
18
"""
19
20
def is_enabled() -> bool:
21
"""
22
Check if advanced mode is currently enabled.
23
24
Returns:
25
bool: True if advanced mode is active
26
"""
27
28
def serialize_json() -> str:
29
"""
30
Export all advanced mode settings as JSON.
31
32
Returns:
33
str: JSON string containing all settings
34
"""
35
36
def load_json(json_content):
37
"""
38
Load advanced mode settings from JSON.
39
40
Args:
41
json_content (str): JSON string with settings
42
"""
43
```
44
45
### Depth Control
46
47
Fine-grained depth processing parameter control.
48
49
```python { .api }
50
class STDepthControlGroup:
51
# Depth processing parameters
52
plusIncrement: int
53
minusIncrement: int
54
deepSeaMedianThreshold: int
55
scoreThreshA: int
56
scoreThreshB: int
57
textureDifferenceThreshold: int
58
textureCountThreshold: int
59
deepSeaSecondPeakThreshold: int
60
deepSeaNeighborThreshold: int
61
lrThreshold: int
62
63
def get_depth_control() -> STDepthControlGroup:
64
"""Get current depth control parameters."""
65
66
def set_depth_control(group):
67
"""
68
Set depth control parameters.
69
70
Args:
71
group (STDepthControlGroup): Depth control settings
72
"""
73
```
74
75
### RSM (RealSense Motion) Control
76
77
Motion-based depth enhancement settings.
78
79
```python { .api }
80
class STRsm:
81
rsmBypass: int
82
diffThresh: float
83
sloRauDiffThresh: float
84
removeThresh: float
85
86
def get_rsm() -> STRsm:
87
"""Get current RSM parameters."""
88
89
def set_rsm(rsm):
90
"""
91
Set RSM parameters.
92
93
Args:
94
rsm (STRsm): RSM settings
95
"""
96
```
97
98
### Color Control
99
100
Advanced color processing and enhancement parameters.
101
102
```python { .api }
103
class STColorControl:
104
disableSADColor: int
105
disableRAUColor: int
106
disableSLORightColor: int
107
disableSLOLeftColor: int
108
disableSADNormalize: int
109
110
def get_color_control() -> STColorControl:
111
"""Get current color control parameters."""
112
113
def set_color_control(control):
114
"""
115
Set color control parameters.
116
117
Args:
118
control (STColorControl): Color control settings
119
"""
120
```
121
122
### Threshold Controls
123
124
Color-based filtering thresholds for depth processing.
125
126
```python { .api }
127
class STRauColorThresholdsControl:
128
rauDiffThresholdRed: int
129
rauDiffThresholdGreen: int
130
rauDiffThresholdBlue: int
131
132
class STSloColorThresholdsControl:
133
sloK1Penalty: int
134
sloK2Penalty: int
135
sloK1PenaltyMod1: int
136
sloK2PenaltyMod1: int
137
sloK1PenaltyMod2: int
138
sloK2PenaltyMod2: int
139
140
def get_rau_color_thresholds_control() -> STRauColorThresholdsControl:
141
"""Get RAU color threshold parameters."""
142
143
def set_rau_color_thresholds_control(control):
144
"""Set RAU color threshold parameters."""
145
146
def get_slo_color_thresholds_control() -> STSloColorThresholdsControl:
147
"""Get SLO color threshold parameters."""
148
149
def set_slo_color_thresholds_control(control):
150
"""Set SLO color threshold parameters."""
151
```
152
153
### Auto-Exposure and White Balance
154
155
Advanced exposure and color temperature controls.
156
157
```python { .api }
158
class STAEControl:
159
meanIntensitySetPoint: int
160
brightRatio: float
161
kpGain: float
162
kiGain: float
163
164
def get_ae_control() -> STAEControl:
165
"""Get auto-exposure control parameters."""
166
167
def set_ae_control(control):
168
"""
169
Set auto-exposure control parameters.
170
171
Args:
172
control (STAEControl): Auto-exposure settings
173
"""
174
```
175
176
### Depth Table and Census
177
178
Depth mapping and census transform parameters.
179
180
```python { .api }
181
class STDepthTableControl:
182
depthUnits: int
183
depthClampMin: int
184
depthClampMax: int
185
disparityMultiplier: int
186
disparityShift: int
187
188
class STCensusRadius:
189
uRadius: int
190
vRadius: int
191
192
def get_depth_table() -> STDepthTableControl:
193
"""Get depth table parameters."""
194
195
def set_depth_table(table):
196
"""Set depth table parameters."""
197
198
def get_census_radius() -> STCensusRadius:
199
"""Get census transform radius."""
200
201
def set_census_radius(radius):
202
"""Set census transform radius."""
203
```
204
205
### Additional Advanced Controls
206
207
```python { .api }
208
class STRauSupportVectorControl:
209
minWest: int
210
minEast: int
211
minNorth: int
212
minSouth: int
213
minNorthEast: int
214
minSouthEast: int
215
minNorthWest: int
216
minSouthWest: int
217
218
class STSloPixelControl:
219
pixel1: int
220
pixel2: int
221
pixel3: int
222
223
class STHdad:
224
lambdaCensus: float
225
lambdaAD: float
226
ignoreSAD: int
227
228
class STColorCorrection:
229
colorCorrection1: float
230
colorCorrection2: float
231
colorCorrection3: float
232
colorCorrection4: float
233
colorCorrection5: float
234
colorCorrection6: float
235
colorCorrection7: float
236
colorCorrection8: float
237
colorCorrection9: float
238
colorCorrection10: float
239
colorCorrection11: float
240
colorCorrection12: float
241
242
class STAFactor:
243
amplitude: float
244
maxRadius: float
245
246
def get_rau_support_vector_control() -> STRauSupportVectorControl:
247
"""Get RAU support vector parameters."""
248
249
def get_color_correction() -> STColorCorrection:
250
"""Get color correction matrix."""
251
252
def get_depth_table() -> STDepthTableControl:
253
"""Get depth table control parameters."""
254
255
def get_ae_control() -> STAEControl:
256
"""Get auto-exposure control parameters."""
257
258
def get_census_radius() -> STCensusRadius:
259
"""Get census radius parameters."""
260
261
def get_depth_control() -> STDepthControlGroup:
262
"""Get depth control group parameters."""
263
264
def get_rsm() -> STRsm:
265
"""Get RSM parameters."""
266
267
def get_rau_color_thresholds_control() -> STRauColorThresholdsControl:
268
"""Get RAU color thresholds."""
269
270
def get_slo_color_thresholds_control() -> STSloColorThresholdsControl:
271
"""Get SLO color thresholds."""
272
273
def get_slo_penalty_control() -> STSloPenaltyControl:
274
"""Get SLO penalty control parameters."""
275
276
def get_hdad() -> STHdad:
277
"""Get HDAD parameters."""
278
279
def get_color_control() -> STColorControl:
280
"""Get color control parameters."""
281
282
def get_depth_table() -> STDepthTableControl:
283
"""Get depth table parameters."""
284
285
def get_auto_exposure_control() -> STAEControl:
286
"""Get auto-exposure control parameters."""
287
288
def get_census_radius() -> STCensusRadius:
289
"""Get census radius parameters."""
290
```
291
292
### JSON Serialization
293
294
For complete settings backup and restore.
295
296
```python { .api }
297
class serializable_device:
298
def serialize_json() -> str:
299
"""
300
Export device settings as JSON.
301
302
Returns:
303
str: JSON string with device configuration
304
"""
305
306
def load_json(json_content):
307
"""
308
Load device settings from JSON.
309
310
Args:
311
json_content (str): JSON configuration string
312
"""
313
```
314
315
## Usage Examples
316
317
### Basic Advanced Mode Activation
318
319
```python
320
import pyrealsense2 as rs
321
322
# Get advanced mode device
323
pipeline = rs.pipeline()
324
profile = pipeline.start()
325
device = profile.get_device()
326
327
# Check if device supports advanced mode
328
if device.is_valid() and device.supports(rs.camera_info.advanced_mode):
329
advanced_mode_dev = device.as_rs400_advanced_mode()
330
331
# Enable advanced mode
332
if not advanced_mode_dev.is_enabled():
333
advanced_mode_dev.toggle_advanced_mode(True)
334
print("Advanced mode enabled")
335
```
336
337
### Depth Control Customization
338
339
```python
340
# Get current depth control settings
341
depth_control = advanced_mode_dev.get_depth_control()
342
343
# Modify settings
344
depth_control.scoreThreshA = 1
345
depth_control.scoreThreshB = 2000
346
depth_control.textureDifferenceThreshold = 1500
347
depth_control.textureCountThreshold = 6
348
349
# Apply new settings
350
advanced_mode_dev.set_depth_control(depth_control)
351
```
352
353
### Settings Backup and Restore
354
355
```python
356
# Backup current settings
357
settings_json = advanced_mode_dev.serialize_json()
358
359
# Save to file for later use
360
with open('camera_settings.json', 'w') as f:
361
f.write(settings_json)
362
363
# Restore settings later
364
with open('camera_settings.json', 'r') as f:
365
saved_settings = f.read()
366
advanced_mode_dev.load_json(saved_settings)
367
```
368
369
## Important Notes
370
371
- **Compatibility**: Advanced mode is only available on RS400 series cameras
372
- **Settings Persistence**: Settings are lost when device is disconnected unless saved to JSON
373
- **Caution Required**: Incorrect advanced mode settings can significantly degrade depth quality
374
- **Testing Recommended**: Always test advanced mode changes with your specific use case
375
- **Factory Reset**: Use JSON backup/restore to return to factory settings if needed