@@ -81,10 +81,19 @@ def socket_type_pair(arg):
81
81
help = "Make OpenCV windows resizable. Note: may introduce some artifacts" )
82
82
parser .add_argument ('-tun' , '--camera-tuning' , type = Path ,
83
83
help = "Path to custom camera tuning database" )
84
- parser .add_argument ('-d' , '--device' , default = "" , type = str ,
85
- help = "Optional MX ID of the device to connect to." )
86
84
parser .add_argument ('-raw' , '--enable-raw' , default = False , action = "store_true" ,
87
85
help = 'Enable the RAW camera streams' )
86
+ parser .add_argument ('-tofraw' , '--tof-raw' , action = 'store_true' ,
87
+ help = "Show just ToF raw output instead of post-processed depth" )
88
+ parser .add_argument ('-tofamp' , '--tof-amplitude' , action = 'store_true' ,
89
+ help = "Show also ToF amplitude output alongside depth" )
90
+ parser .add_argument ('-tofcm' , '--tof-cm' , action = 'store_true' ,
91
+ help = "Show ToF depth output in centimeters, capped to 255" )
92
+ parser .add_argument ('-rgbprev' , '--rgb-preview' , action = 'store_true' ,
93
+ help = "Show RGB `preview` stream instead of full size `isp`" )
94
+
95
+ parser .add_argument ('-d' , '--device' , default = "" , type = str ,
96
+ help = "Optional MX ID of the device to connect to." )
88
97
89
98
parser .add_argument ('-ctimeout' , '--connection-timeout' , default = 30000 ,
90
99
help = "Connection timeout in ms. Default: %(default)s (sets DEPTHAI_CONNECTION_TIMEOUT environment variable)" )
@@ -188,6 +197,7 @@ def get(self):
188
197
tof = {}
189
198
xout = {}
190
199
xout_raw = {}
200
+ xout_tof_amp = {}
191
201
streams = []
192
202
tofConfig = {}
193
203
for c in cam_list :
@@ -209,6 +219,12 @@ def get(self):
209
219
tofConfig .depthParams .avgPhaseShuffle = False
210
220
tofConfig .depthParams .minimumAmplitude = 3.0
211
221
tof [c ].initialConfig .set (tofConfig )
222
+ if args .tof_amplitude :
223
+ amp_name = 'tof_amplitude_' + c
224
+ xout_tof_amp [c ] = pipeline .create (dai .node .XLinkOut )
225
+ xout_tof_amp [c ].setStreamName (amp_name )
226
+ streams .append (amp_name )
227
+ tof [c ].amplitude .link (xout_tof_amp [c ].input )
212
228
elif cam_type_color [c ]:
213
229
cam [c ] = pipeline .createColorCamera ()
214
230
cam [c ].setResolution (color_res_opts [args .color_resolution ])
@@ -240,7 +256,7 @@ def get(self):
240
256
xout_raw [c ] = pipeline .create (dai .node .XLinkOut )
241
257
xout_raw [c ].setStreamName (raw_name )
242
258
streams .append (raw_name )
243
- tof [c ].amplitude .link (xout_raw [c ].input )
259
+ cam [c ].raw .link (xout_raw [c ].input )
244
260
cam [c ].setRawOutputPacked (False )
245
261
246
262
if args .camera_tuning :
@@ -271,6 +287,8 @@ def exit_cleanly(signum, frame):
271
287
cam_name [p .socket .name ] = p .sensorName
272
288
if args .enable_raw :
273
289
cam_name ['raw_' + p .socket .name ] = p .sensorName
290
+ if args .tof_amplitude :
291
+ cam_name ['tof_amplitude_' + p .socket .name ] = p .sensorName
274
292
275
293
print ('USB speed:' , device .getUsbSpeed ().name )
276
294
@@ -352,7 +370,7 @@ def exit_cleanly(signum, frame):
352
370
fps_capt [c ].update (pkt .getTimestamp ().total_seconds ())
353
371
width , height = pkt .getWidth (), pkt .getHeight ()
354
372
frame = pkt .getCvFrame ()
355
- if cam_type_tof [c .split ('_' )[- 1 ]] and not c .startswith ('raw_' ):
373
+ if cam_type_tof [c .split ('_' )[- 1 ]] and not ( c .startswith ('raw_' ) or c . startswith ( 'tof_amplitude_' ) ):
356
374
if args .tof_cm :
357
375
# pixels represent `cm`, capped to 255. Value can be checked hovering the mouse
358
376
frame = (frame // 10 ).clip (0 , 255 ).astype (np .uint8 )
@@ -379,7 +397,7 @@ def exit_cleanly(signum, frame):
379
397
)
380
398
capture_list .remove (c )
381
399
print ()
382
- if c .startswith ('raw_' ):
400
+ if c .startswith ('raw_' ) or c . startswith ( 'tof_amplitude_' ) :
383
401
if capture :
384
402
filename = capture_file_info + '_10bit.bw'
385
403
print ('Saving:' , filename )
0 commit comments