@@ -166,6 +166,8 @@ def parse_args():
166166 help = "Enable the display of polynoms." )
167167 parser .add_argument ('-dbg' , '--debugProcessingMode' , default = False , action = "store_true" ,
168168 help = "Enable processing of images without using the camera." )
169+ parser .add_argument ('-v3' , '--useDepthaiV3' , default = False , action = "store_true" ,
170+ help = "Use depthai v3." )
169171 options = parser .parse_args ()
170172 # Set some extra defaults, `-brd` would override them
171173 if options .defaultBoard is not None :
@@ -462,14 +464,18 @@ def mouse_event_callback(self, event, x, y, flags, param):
462464 self .mouseTrigger = True
463465
464466 def startPipeline (self ):
465- pipeline = self .create_pipeline ()
466- self .device .startPipeline (pipeline )
467-
468- self .camera_queue = {}
469- for config_cam in self .board_config ['cameras' ]:
470- cam = self .board_config ['cameras' ][config_cam ]
471- if cam ["name" ] not in self .args .disableCamera :
472- self .camera_queue [cam ['name' ]] = self .device .getOutputQueue (cam ['name' ], 1 , False )
467+ if not self .args .useDepthaiV3 :
468+ pipeline = self .create_pipeline ()
469+ self .device .startPipeline (pipeline )
470+ self .camera_queue = {}
471+ for config_cam in self .board_config ['cameras' ]:
472+ cam = self .board_config ['cameras' ][config_cam ]
473+ if cam ["name" ] not in self .args .disableCamera :
474+ self .camera_queue [cam ['name' ]] = self .device .getOutputQueue (cam ['name' ], 1 , False )
475+ else :
476+ pipeline = self .create_pipeline_v3 ()
477+ pipeline .start ()
478+ self .pipeline = pipeline
473479
474480 def is_markers_found (self , frame ):
475481 marker_corners , _ , _ = cv2 .aruco .detectMarkers (
@@ -579,6 +585,39 @@ def create_pipeline(self):
579585
580586 return pipeline
581587
588+ def create_pipeline_v3 (self ):
589+ pipeline = dai .Pipeline (self .device )
590+ self .camera_queue = {}
591+ fps = self .args .framerate
592+ for cam_id in self .board_config ['cameras' ]:
593+ cam_info = self .board_config ['cameras' ][cam_id ]
594+ if cam_info ["name" ] not in self .args .disableCamera :
595+ if cam_info ['type' ] == 'mono' :
596+ cam_node = pipeline .create (dai .node .Camera ).build (stringToCam [cam_id ])
597+ self .camera_queue [cam_info ['name' ]] = cam_node .requestFullResolutionOutput (type = dai .ImgFrame .Type .NV12 ).createOutputQueue (blocking = False )
598+ sensorName = cam_info ['sensorName' ]
599+ print (f'Sensor name for { cam_info ["name" ]} is { sensorName } ' )
600+ else :
601+ cam_node = pipeline .create (dai .node .Camera ).build (stringToCam [cam_id ])
602+ self .camera_queue [cam_info ['name' ]] = cam_node .requestFullResolutionOutput (type = dai .ImgFrame .Type .NV12 ).createOutputQueue (blocking = False )
603+ if cam_info ['sensorName' ] == "OV9*82" :
604+ cam_node .initialControl .setSharpness (0 )
605+ cam_node .initialControl .setLumaDenoise (0 )
606+ cam_node .initialControl .setChromaDenoise (4 )
607+
608+ if cam_info ['hasAutofocus' ]:
609+ if self .args .rgbLensPosition :
610+ cam_node .initialControl .setManualFocus (int (self .args .rgbLensPosition [stringToCam [cam_id ].name .lower ()]))
611+ else :
612+ cam_node .initialControl .setManualFocusRaw (int (130 / 255 ))
613+
614+ controlIn = pipeline .createXLinkIn ()
615+ controlIn .setStreamName (cam_info ['name' ] + '-control' )
616+ controlIn .out .link (cam_node .inputControl )
617+ sensorName = cam_info ['sensorName' ]
618+ print (f'Sensor name for { cam_info ["name" ]} is { sensorName } ' )
619+ cam_node .initialControl .setAntiBandingMode (antibandingOpts [self .args .antibanding ])
620+ return pipeline
582621
583622 def parse_frame (self , frame , stream_name ):
584623 if not self .is_markers_found (frame ):
@@ -724,7 +763,7 @@ def capture_images_sync(self):
724763
725764 syncCollector .add_msg (key , frameMsg )
726765 color_frame = None
727- if frameMsg .getType () in [dai .RawImgFrame .Type .RAW8 , dai .RawImgFrame .Type .GRAY8 ] :
766+ if not self . args . useDepthaiV3 and frameMsg .getType () in [dai .RawImgFrame .Type .RAW8 , dai .RawImgFrame .Type .GRAY8 ] :
728767 color_frame = cv2 .cvtColor (frameMsg .getCvFrame (), cv2 .COLOR_GRAY2BGR )
729768 else :
730769 color_frame = frameMsg .getCvFrame ()
@@ -1082,7 +1121,10 @@ def calibrate(self):
10821121 print (f'EEPROM VERSION being flashed is -> { eeepromData .version } ' )
10831122 eeepromData .version = 7
10841123 print (f'EEPROM VERSION being flashed is -> { eeepromData .version } ' )
1085- mx_serial_id = self .device .getDeviceInfo ().getMxId ()
1124+ if not self .args .useDepthaiV3 :
1125+ mx_serial_id = self .device .getDeviceInfo ().getMxId ()
1126+ else :
1127+ mx_serial_id = self .device .getDeviceId ()
10861128 date_time_string = datetime .now ().strftime ("_%m_%d_%y_%H_%M" )
10871129 file_name = mx_serial_id + date_time_string
10881130 calib_dest_path = dest_path + '/' + file_name + '.json'
0 commit comments