forked from IntelRealSense/librealsense
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyrs_advanced_mode.cpp
263 lines (249 loc) · 15.7 KB
/
pyrs_advanced_mode.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
/* License: Apache 2.0. See LICENSE file in root directory.
Copyright(c) 2017 Intel Corporation. All Rights Reserved. */
#include "pyrealsense2.h"
#include <librealsense2/rs_advanced_mode.hpp>
#include <librealsense2/hpp/rs_serializable_device.hpp>
void init_advanced_mode(py::module &m) {
/** RS400 Advanced Mode commands **/
py::class_<STDepthControlGroup> _STDepthControlGroup(m, "STDepthControlGroup");
_STDepthControlGroup.def(py::init<>())
.def_readwrite("plusIncrement", &STDepthControlGroup::plusIncrement)
.def_readwrite("minusDecrement", &STDepthControlGroup::minusDecrement)
.def_readwrite("deepSeaMedianThreshold", &STDepthControlGroup::deepSeaMedianThreshold)
.def_readwrite("scoreThreshA", &STDepthControlGroup::scoreThreshA)
.def_readwrite("scoreThreshB", &STDepthControlGroup::scoreThreshB)
.def_readwrite("textureDifferenceThreshold", &STDepthControlGroup::textureDifferenceThreshold)
.def_readwrite("textureCountThreshold", &STDepthControlGroup::textureCountThreshold)
.def_readwrite("deepSeaSecondPeakThreshold", &STDepthControlGroup::deepSeaSecondPeakThreshold)
.def_readwrite("deepSeaNeighborThreshold", &STDepthControlGroup::deepSeaNeighborThreshold)
.def_readwrite("lrAgreeThreshold", &STDepthControlGroup::lrAgreeThreshold)
.def("__repr__", [](const STDepthControlGroup &e) {
std::stringstream ss;
ss << "minusDecrement: " << e.minusDecrement << ", ";
ss << "deepSeaMedianThreshold: " << e.deepSeaMedianThreshold << ", ";
ss << "scoreThreshA: " << e.scoreThreshA << ", ";
ss << "scoreThreshB: " << e.scoreThreshB << ", ";
ss << "textureDifferenceThreshold: " << e.textureDifferenceThreshold << ", ";
ss << "textureCountThreshold: " << e.textureCountThreshold << ", ";
ss << "deepSeaSecondPeakThreshold: " << e.deepSeaSecondPeakThreshold << ", ";
ss << "deepSeaNeighborThreshold: " << e.deepSeaNeighborThreshold << ", ";
ss << "lrAgreeThreshold: " << e.lrAgreeThreshold;
return ss.str();
});
py::class_<STRsm> _STRsm(m, "STRsm");
_STRsm.def(py::init<>())
.def_readwrite("rsmBypass", &STRsm::rsmBypass)
.def_readwrite("diffThresh", &STRsm::diffThresh)
.def_readwrite("sloRauDiffThresh", &STRsm::sloRauDiffThresh)
.def_readwrite("removeThresh", &STRsm::removeThresh)
.def("__repr__", [](const STRsm &e) {
std::stringstream ss;
ss << "rsmBypass: " << e.rsmBypass << ", ";
ss << "diffThresh: " << e.diffThresh << ", ";
ss << "sloRauDiffThresh: " << e.sloRauDiffThresh << ", ";
ss << "removeThresh: " << e.removeThresh;
return ss.str();
});
py::class_<STRauSupportVectorControl> _STRauSupportVectorControl(m, "STRauSupportVectorControl");
_STRauSupportVectorControl.def(py::init<>())
.def_readwrite("minWest", &STRauSupportVectorControl::minWest)
.def_readwrite("minEast", &STRauSupportVectorControl::minEast)
.def_readwrite("minWEsum", &STRauSupportVectorControl::minWEsum)
.def_readwrite("minNorth", &STRauSupportVectorControl::minNorth)
.def_readwrite("minSouth", &STRauSupportVectorControl::minSouth)
.def_readwrite("minNSsum", &STRauSupportVectorControl::minNSsum)
.def_readwrite("uShrink", &STRauSupportVectorControl::uShrink)
.def_readwrite("vShrink", &STRauSupportVectorControl::vShrink)
.def("__repr__", [](const STRauSupportVectorControl &e) {
std::stringstream ss;
ss << "minWest: " << e.minWest << ", ";
ss << "minEast: " << e.minEast << ", ";
ss << "minWEsum: " << e.minWEsum << ", ";
ss << "minNorth: " << e.minNorth << ", ";
ss << "minSouth: " << e.minSouth << ", ";
ss << "minNSsum: " << e.minNSsum << ", ";
ss << "uShrink: " << e.uShrink << ", ";
ss << "vShrink: " << e.vShrink;
return ss.str();
});
py::class_<STColorControl> _STColorControl(m, "STColorControl");
_STColorControl.def(py::init<>())
.def_readwrite("disableSADColor", &STColorControl::disableSADColor)
.def_readwrite("disableRAUColor", &STColorControl::disableRAUColor)
.def_readwrite("disableSLORightColor", &STColorControl::disableSLORightColor)
.def_readwrite("disableSLOLeftColor", &STColorControl::disableSLOLeftColor)
.def_readwrite("disableSADNormalize", &STColorControl::disableSADNormalize)
.def("__repr__", [](const STColorControl &e) {
std::stringstream ss;
ss << "disableSADColor: " << e.disableSADColor << ", ";
ss << "disableRAUColor: " << e.disableRAUColor << ", ";
ss << "disableSLORightColor: " << e.disableSLORightColor << ", ";
ss << "disableSLOLeftColor: " << e.disableSLOLeftColor << ", ";
ss << "disableSADNormalize: " << e.disableSADNormalize;
return ss.str();
});
py::class_<STRauColorThresholdsControl> _STRauColorThresholdsControl(m, "STRauColorThresholdsControl");
_STRauColorThresholdsControl.def(py::init<>())
.def_readwrite("rauDiffThresholdRed", &STRauColorThresholdsControl::rauDiffThresholdRed)
.def_readwrite("rauDiffThresholdGreen", &STRauColorThresholdsControl::rauDiffThresholdGreen)
.def_readwrite("rauDiffThresholdBlue", &STRauColorThresholdsControl::rauDiffThresholdBlue)
.def("__repr__", [](const STRauColorThresholdsControl &e) {
std::stringstream ss;
ss << "rauDiffThresholdRed: " << e.rauDiffThresholdRed << ", ";
ss << "rauDiffThresholdGreen: " << e.rauDiffThresholdGreen << ", ";
ss << "rauDiffThresholdBlue: " << e.rauDiffThresholdBlue;
return ss.str();
});
py::class_<STSloColorThresholdsControl> _STSloColorThresholdsControl(m, "STSloColorThresholdsControl");
_STSloColorThresholdsControl.def(py::init<>())
.def_readwrite("diffThresholdRed", &STSloColorThresholdsControl::diffThresholdRed)
.def_readwrite("diffThresholdGreen", &STSloColorThresholdsControl::diffThresholdGreen)
.def_readwrite("diffThresholdBlue", &STSloColorThresholdsControl::diffThresholdBlue)
.def("__repr__", [](const STSloColorThresholdsControl &e) {
std::stringstream ss;
ss << "diffThresholdRed: " << e.diffThresholdRed << ", ";
ss << "diffThresholdGreen: " << e.diffThresholdGreen << ", ";
ss << "diffThresholdBlue: " << e.diffThresholdBlue;
return ss.str();
});
py::class_<STSloPenaltyControl> _STSloPenaltyControl(m, "STSloPenaltyControl");
_STSloPenaltyControl.def(py::init<>())
.def_readwrite("sloK1Penalty", &STSloPenaltyControl::sloK1Penalty)
.def_readwrite("sloK2Penalty", &STSloPenaltyControl::sloK2Penalty)
.def_readwrite("sloK1PenaltyMod1", &STSloPenaltyControl::sloK1PenaltyMod1)
.def_readwrite("sloK2PenaltyMod1", &STSloPenaltyControl::sloK2PenaltyMod1)
.def_readwrite("sloK1PenaltyMod2", &STSloPenaltyControl::sloK1PenaltyMod2)
.def_readwrite("sloK2PenaltyMod2", &STSloPenaltyControl::sloK2PenaltyMod2)
.def("__repr__", [](const STSloPenaltyControl &e) {
std::stringstream ss;
ss << "sloK1Penalty: " << e.sloK1Penalty << ", ";
ss << "sloK2Penalty: " << e.sloK2Penalty << ", ";
ss << "sloK1PenaltyMod1: " << e.sloK1PenaltyMod1 << ", ";
ss << "sloK2PenaltyMod1: " << e.sloK2PenaltyMod1 << ", ";
ss << "sloK1PenaltyMod2: " << e.sloK1PenaltyMod2 << ", ";
ss << "sloK2PenaltyMod2: " << e.sloK2PenaltyMod2;
return ss.str();
});
py::class_<STHdad> _STHdad(m, "STHdad");
_STHdad.def(py::init<>())
.def_readwrite("lambdaCensus", &STHdad::lambdaCensus)
.def_readwrite("lambdaAD", &STHdad::lambdaAD)
.def_readwrite("ignoreSAD", &STHdad::ignoreSAD)
.def("__repr__", [](const STHdad &e) {
std::stringstream ss;
ss << "lambdaCensus: " << e.lambdaCensus << ", ";
ss << "lambdaAD: " << e.lambdaAD << ", ";
ss << "ignoreSAD: " << e.ignoreSAD;
return ss.str();
});
py::class_<STColorCorrection> _STColorCorrection(m, "STColorCorrection");
_STColorCorrection.def(py::init<>())
.def_readwrite("colorCorrection1", &STColorCorrection::colorCorrection1)
.def_readwrite("colorCorrection2", &STColorCorrection::colorCorrection2)
.def_readwrite("colorCorrection3", &STColorCorrection::colorCorrection3)
.def_readwrite("colorCorrection4", &STColorCorrection::colorCorrection4)
.def_readwrite("colorCorrection5", &STColorCorrection::colorCorrection5)
.def_readwrite("colorCorrection6", &STColorCorrection::colorCorrection6)
.def_readwrite("colorCorrection7", &STColorCorrection::colorCorrection7)
.def_readwrite("colorCorrection8", &STColorCorrection::colorCorrection8)
.def_readwrite("colorCorrection9", &STColorCorrection::colorCorrection9)
.def_readwrite("colorCorrection10", &STColorCorrection::colorCorrection10)
.def_readwrite("colorCorrection11", &STColorCorrection::colorCorrection11)
.def_readwrite("colorCorrection12", &STColorCorrection::colorCorrection12)
.def("__repr__", [](const STColorCorrection &e) {
std::stringstream ss;
ss << "colorCorrection1: " << e.colorCorrection1 << ", ";
ss << "colorCorrection2: " << e.colorCorrection2 << ", ";
ss << "colorCorrection3: " << e.colorCorrection3 << ", ";
ss << "colorCorrection4: " << e.colorCorrection4 << ", ";
ss << "colorCorrection5: " << e.colorCorrection5 << ", ";
ss << "colorCorrection6: " << e.colorCorrection6 << ", ";
ss << "colorCorrection7: " << e.colorCorrection7 << ", ";
ss << "colorCorrection8: " << e.colorCorrection8 << ", ";
ss << "colorCorrection9: " << e.colorCorrection9 << ", ";
ss << "colorCorrection10: " << e.colorCorrection10 << ", ";
ss << "colorCorrection11: " << e.colorCorrection11 << ", ";
ss << "colorCorrection12: " << e.colorCorrection12;
return ss.str();
});
py::class_<STAEControl> _STAEControl(m, "STAEControl");
_STAEControl.def(py::init<>())
.def_readwrite("meanIntensitySetPoint", &STAEControl::meanIntensitySetPoint)
.def("__repr__", [](const STAEControl &e) {
std::stringstream ss;
ss << "Mean Intensity Set Point: " << e.meanIntensitySetPoint;
return ss.str();
});
py::class_<STDepthTableControl> _STDepthTableControl(m, "STDepthTableControl");
_STDepthTableControl.def(py::init<>())
.def_readwrite("depthUnits", &STDepthTableControl::depthUnits)
.def_readwrite("depthClampMin", &STDepthTableControl::depthClampMin)
.def_readwrite("depthClampMax", &STDepthTableControl::depthClampMax)
.def_readwrite("disparityMode", &STDepthTableControl::disparityMode)
.def_readwrite("disparityShift", &STDepthTableControl::disparityShift)
.def("__repr__", [](const STDepthTableControl &e) {
std::stringstream ss;
ss << "depthUnits: " << e.depthUnits << ", ";
ss << "depthClampMin: " << e.depthClampMin << ", ";
ss << "depthClampMax: " << e.depthClampMax << ", ";
ss << "disparityMode: " << e.disparityMode << ", ";
ss << "disparityShift: " << e.disparityShift;
return ss.str();
});
py::class_<STCensusRadius> _STCensusRadius(m, "STCensusRadius");
_STCensusRadius.def(py::init<>())
.def_readwrite("uDiameter", &STCensusRadius::uDiameter)
.def_readwrite("vDiameter", &STCensusRadius::vDiameter)
.def("__repr__", [](const STCensusRadius &e) {
std::stringstream ss;
ss << "uDiameter: " << e.uDiameter << ", ";
ss << "vDiameter: " << e.vDiameter;
return ss.str();
});
py::class_<STAFactor> _STAFactor(m, "STAFactor");
_STAFactor.def(py::init<>())
.def_readwrite("a_factor", &STAFactor::amplitude)
.def("__repr__", [](const STAFactor &e) {
std::stringstream ss;
ss << "a_factor: " << e.amplitude;
return ss.str();
});
py::class_<rs400::advanced_mode> rs400_advanced_mode(m, "rs400_advanced_mode");
rs400_advanced_mode.def(py::init<rs2::device>(), "device"_a)
.def("toggle_advanced_mode", &rs400::advanced_mode::toggle_advanced_mode, "enable"_a)
.def("is_enabled", &rs400::advanced_mode::is_enabled)
.def("set_depth_control", &rs400::advanced_mode::set_depth_control, "group"_a) //STDepthControlGroup
.def("get_depth_control", &rs400::advanced_mode::get_depth_control, "mode"_a = 0)
.def("set_rsm", &rs400::advanced_mode::set_rsm, "group") //STRsm
.def("get_rsm", &rs400::advanced_mode::get_rsm, "mode"_a = 0)
.def("set_rau_support_vector_control", &rs400::advanced_mode::set_rau_support_vector_control, "group"_a)//STRauSupportVectorControl
.def("get_rau_support_vector_control", &rs400::advanced_mode::get_rau_support_vector_control, "mode"_a = 0)
.def("set_color_control", &rs400::advanced_mode::set_color_control, "group"_a) //STColorControl
.def("get_color_control", &rs400::advanced_mode::get_color_control, "mode"_a = 0)//STColorControl
.def("set_rau_thresholds_control", &rs400::advanced_mode::set_rau_thresholds_control, "group"_a)//STRauColorThresholdsControl
.def("get_rau_thresholds_control", &rs400::advanced_mode::get_rau_thresholds_control, "mode"_a = 0)
.def("set_slo_color_thresholds_control", &rs400::advanced_mode::set_slo_color_thresholds_control, "group"_a)//STSloColorThresholdsControl
.def("get_slo_color_thresholds_control", &rs400::advanced_mode::get_slo_color_thresholds_control, "mode"_a = 0)//STSloColorThresholdsControl
.def("set_slo_penalty_control", &rs400::advanced_mode::set_slo_penalty_control, "group"_a) //STSloPenaltyControl
.def("get_slo_penalty_control", &rs400::advanced_mode::get_slo_penalty_control, "mode"_a = 0)//STSloPenaltyControl
.def("set_hdad", &rs400::advanced_mode::set_hdad, "group"_a) //STHdad
.def("get_hdad", &rs400::advanced_mode::get_hdad, "mode"_a = 0)
.def("set_color_correction", &rs400::advanced_mode::set_color_correction, "group"_a)
.def("get_color_correction", &rs400::advanced_mode::get_color_correction, "mode"_a = 0) //STColorCorrection
.def("set_depth_table", &rs400::advanced_mode::set_depth_table, "group"_a)
.def("get_depth_table", &rs400::advanced_mode::get_depth_table, "mode"_a = 0) //STDepthTableControl
.def("set_ae_control", &rs400::advanced_mode::set_ae_control, "group"_a)
.def("get_ae_control", &rs400::advanced_mode::get_ae_control, "mode"_a = 0) //STAEControl
.def("set_census", &rs400::advanced_mode::set_census, "group"_a) //STCensusRadius
.def("get_census", &rs400::advanced_mode::get_census, "mode"_a = 0) //STCensusRadius
.def("set_amp_factor", &rs400::advanced_mode::set_amp_factor, "group"_a) //STAFactor
.def("get_amp_factor", &rs400::advanced_mode::get_amp_factor, "mode"_a = 0) //STAFactor
.def("serialize_json", &rs400::advanced_mode::serialize_json)
.def("load_json", &rs400::advanced_mode::load_json, "json_content"_a);
}
void init_serializable_device(py::module& m) {
py::class_<rs2::serializable_device> serializable_device(m, "serializable_device");
serializable_device.def(py::init<rs2::device>(), "device"_a)
.def("serialize_json", &rs2::serializable_device::serialize_json)
.def("load_json", &rs2::serializable_device::load_json, "json_content"_a);
}