@@ -189,6 +189,7 @@ def get(self):
189189xout = {}
190190xout_raw = {}
191191streams = []
192+ tofConfig = {}
192193for 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