Skip to content

Commit 8c2b0cd

Browse files
FlorinBuica-luxonisalex-luxonis
authored andcommitted
preparing to merge to tof vga
1 parent 32831ae commit 8c2b0cd

File tree

5 files changed

+30
-7
lines changed

5 files changed

+30
-7
lines changed

src/DatatypeBindings.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ void bind_spatiallocationcalculatordata(pybind11::module& m, void* pCallstack);
2121
void bind_stereodepthconfig(pybind11::module& m, void* pCallstack);
2222
void bind_systeminformation(pybind11::module& m, void* pCallstack);
2323
void bind_trackedfeatures(pybind11::module& m, void* pCallstack);
24+
void bind_tofconfig(pybind11::module& m, void* pCallstack);
2425
void bind_tracklets(pybind11::module& m, void* pCallstack);
2526

2627
void DatatypeBindings::addToCallstack(std::deque<StackFunction>& callstack) {
@@ -46,6 +47,7 @@ void DatatypeBindings::addToCallstack(std::deque<StackFunction>& callstack) {
4647
callstack.push_front(bind_stereodepthconfig);
4748
callstack.push_front(bind_systeminformation);
4849
callstack.push_front(bind_trackedfeatures);
50+
callstack.push_front(bind_tofconfig);
4951
callstack.push_front(bind_tracklets);
5052
}
5153

src/pipeline/datatype/ToFConfigBindings.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,11 @@ void bind_tofconfig(pybind11::module& m, void* pCallstack){
5858
toFConfig
5959
.def(py::init<>())
6060
.def(py::init<std::shared_ptr<RawToFConfig>>())
61-
61+
6262
.def("setDepthParams", static_cast<ToFConfig&(ToFConfig::*)(dai::ToFConfig::DepthParams)>(&ToFConfig::setDepthParams), py::arg("config"), DOC(dai, ToFConfig, setDepthParams, 2))
63+
.def("setFreqModUsed", static_cast<ToFConfig&(ToFConfig::*)(dai::ToFConfig::DepthParams::TypeFMod)>(&ToFConfig::setFreqModUsed), DOC(dai, ToFConfig, setDepthParams, 2))
64+
.def("setAvgPhaseShuffle", &ToFConfig::setAvgPhaseShuffle, DOC(dai, node, ToFConfig, setAvgPhaseShuffle))
65+
.def("setMinAmplitude", &ToFConfig::setMinAmplitude, DOC(dai, node, ToFConfig, setMinAmplitude))
6366

6467
.def("set", &ToFConfig::set, py::arg("config"), DOC(dai, ToFConfig, set))
6568
.def("get", &ToFConfig::get, DOC(dai, ToFConfig, get))

src/pipeline/node/NodeBindings.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ void bind_edgedetector(pybind11::module& m, void* pCallstack);
114114
void bind_featuretracker(pybind11::module& m, void* pCallstack);
115115
void bind_apriltag(pybind11::module& m, void* pCallstack);
116116
void bind_detectionparser(pybind11::module& m, void* pCallstack);
117+
void bind_tof(pybind11::module& m, void* pCallstack);
117118

118119
void NodeBindings::addToCallstack(std::deque<StackFunction>& callstack) {
119120
// Bind Node et al
@@ -143,6 +144,7 @@ void NodeBindings::addToCallstack(std::deque<StackFunction>& callstack) {
143144
callstack.push_front(bind_featuretracker);
144145
callstack.push_front(bind_apriltag);
145146
callstack.push_front(bind_detectionparser);
147+
callstack.push_front(bind_tof);
146148
}
147149

148150
void NodeBindings::bind(pybind11::module& m, void* pCallstack){

src/pipeline/node/ToFBindings.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ void bind_tof(pybind11::module& m, void* pCallstack){
2929

3030
// Properties
3131
tofProperties
32-
.def_readwrite("initialConfig", &ToFProperties::initialConfig)
32+
.def_readwrite("initialConfig", &ToFProperties::initialConfig, DOC(dai, ToFProperties, initialConfig))
3333
;
3434

3535
// Node
3636
tof
37-
.def_readonly("input", &ToF::input, DOC(dai, node, ToF, input), DOC(dai, node, ToF, input))
3837
.def_readonly("inputConfig", &ToF::inputConfig, DOC(dai, node, ToF, inputConfig), DOC(dai, node, ToF, inputConfig))
38+
.def_readonly("input", &ToF::input, DOC(dai, node, ToF, input), DOC(dai, node, ToF, input))
3939
.def_readonly("depth", &ToF::depth, DOC(dai, node, ToF, depth), DOC(dai, node, ToF, depth))
4040
.def_readonly("amplitude", &ToF::amplitude, DOC(dai, node, ToF, amplitude), DOC(dai, node, ToF, amplitude))
4141
.def_readonly("error", &ToF::error, DOC(dai, node, ToF, error), DOC(dai, node, ToF, error))

utilities/cam_test.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ def get(self):
189189
xout = {}
190190
xout_raw = {}
191191
streams = []
192+
tofConfig = {}
192193
for c in cam_list:
193194
tofEnableRaw = False
194195
xout[c] = pipeline.createXLinkOut()
@@ -204,9 +205,10 @@ def get(self):
204205
tof[c].depth.link(xout[c].input)
205206
xinTofConfig.out.link(tof[c].inputConfig)
206207
tofConfig = tof[c].initialConfig.get()
207-
tofConfig.setFreqModUsed(dai.ToFConfig.DepthParams.TypeFMod.F_MOD_MIN)
208-
tofConfig.SetAvgPhaseShuffle(True)
209-
tofConfig.setMinAmplitude(20.0)
208+
tofConfig.depthParams.freqModUsed = dai.RawToFConfig.DepthParams.TypeFMod.MIN
209+
tofConfig.depthParams.avgPhaseShuffle = False
210+
tofConfig.depthParams.minimumAmplitude = 3.0
211+
tof[c].initialConfig.set(tofConfig)
210212
elif cam_type_color[c]:
211213
cam[c] = pipeline.createColorCamera()
212214
cam[c].setResolution(color_res_opts[args.color_resolution])
@@ -287,6 +289,7 @@ def exit_cleanly(signum, frame):
287289
fps_capt[c] = FPS()
288290

289291
controlQueue = device.getInputQueue('control')
292+
tofCfgQueue = device.getInputQueue('tofConfig')
290293

291294
# Manual exposure/focus set step
292295
EXP_STEP = 500 # us
@@ -331,6 +334,7 @@ def exit_cleanly(signum, frame):
331334
chroma_denoise = 0
332335
control = 'none'
333336
show = False
337+
tof_amp_min = tofConfig.depthParams.minimumAmplitude
334338

335339
print("Cam:", *[' ' + c.ljust(8)
336340
for c in cam_list], "[host | capture timestamp]")
@@ -419,6 +423,11 @@ def exit_cleanly(signum, frame):
419423
elif key == ord('c'):
420424
capture_list = streams.copy()
421425
capture_time = time.strftime('%Y%m%d_%H%M%S')
426+
elif key == ord('g'):
427+
f_mod = dai.RawToFConfig.DepthParams.TypeFMod.MAX if tofConfig.depthParams.freqModUsed == dai.RawToFConfig.DepthParams.TypeFMod.MIN else dai.RawToFConfig.DepthParams.TypeFMod.MIN
428+
print("ToF toggling f_mod value to:", f_mod)
429+
tofConfig.depthParams.freqModUsed = f_mod
430+
tofCfgQueue.send(tofConfig)
422431
elif key == ord('t'):
423432
print("Autofocus trigger (and disable continuous)")
424433
ctrl = dai.CameraControl()
@@ -493,7 +502,7 @@ def exit_cleanly(signum, frame):
493502
if floodIntensity < 0:
494503
floodIntensity = 0
495504
device.setIrFloodLightBrightness(floodIntensity)
496-
elif key >= 0 and chr(key) in '34567890[]':
505+
elif key >= 0 and chr(key) in '34567890[]p':
497506
if key == ord('3'):
498507
control = 'awb_mode'
499508
elif key == ord('4'):
@@ -514,6 +523,8 @@ def exit_cleanly(signum, frame):
514523
control = 'luma_denoise'
515524
elif key == ord(']'):
516525
control = 'chroma_denoise'
526+
elif key == ord('p'):
527+
control = 'tof_amplitude_min'
517528
print("Selected control:", control)
518529
elif key in [ord('-'), ord('_'), ord('+'), ord('=')]:
519530
change = 0
@@ -564,4 +575,9 @@ def exit_cleanly(signum, frame):
564575
chroma_denoise = clamp(chroma_denoise + change, 0, 4)
565576
print("Chroma denoise:", chroma_denoise)
566577
ctrl.setChromaDenoise(chroma_denoise)
578+
elif control == 'tof_amplitude_min':
579+
amp_min = clamp(tofConfig.depthParams.minimumAmplitude + change, 0, 50)
580+
print("Setting min amplitude(confidence) to:", amp_min)
581+
tofConfig.depthParams.minimumAmplitude = amp_min
582+
tofCfgQueue.send(tofConfig)
567583
controlQueue.send(ctrl)

0 commit comments

Comments
 (0)