(plotter=None, visualizer=None)
| 245 | |
| 246 | should_quit = threading.Event() |
| 247 | def main_loop(plotter=None, visualizer=None): |
| 248 | frame_number = 1 |
| 249 | |
| 250 | deviceInfo = None |
| 251 | if args.mxid: deviceInfo = depthai.DeviceInfo(args.mxid) |
| 252 | def createDevice(): |
| 253 | if deviceInfo: |
| 254 | return depthai.Device(pipeline, deviceInfo=deviceInfo, maxUsbSpeed=depthai.UsbSpeed.SUPER_PLUS) |
| 255 | return depthai.Device(pipeline) |
| 256 | |
| 257 | with createDevice() as device, vio_pipeline.startSession(device) as vio_session: |
| 258 | |
| 259 | if args.ir_dot_brightness > 0: |
| 260 | device.setIrLaserDotProjectorBrightness(args.ir_dot_brightness) |
| 261 | |
| 262 | grayVideos = [] |
| 263 | if args.gray: |
| 264 | def open_gray_video(name): |
| 265 | grayVideoFile = open(outputFolder + '/rectified_' + name + '.h264', 'wb') |
| 266 | queue = device.getOutputQueue(name='h264-' + name, maxSize=10, blocking=False) |
| 267 | return (queue, grayVideoFile) |
| 268 | |
| 269 | grayVideos = [ |
| 270 | open_gray_video('left'), |
| 271 | open_gray_video('right') |
| 272 | ] |
| 273 | |
| 274 | grayPreviews = [] |
| 275 | if args.gray_preview: |
| 276 | def open_gray_preview(name): |
| 277 | queue = device.getOutputQueue(name='gray-preview-' + name, maxSize=10, blocking=False) |
| 278 | return (queue, name) |
| 279 | |
| 280 | grayPreviews = [ |
| 281 | open_gray_preview('left'), |
| 282 | open_gray_preview('right') |
| 283 | ] |
| 284 | |
| 285 | if rgb_as_video: |
| 286 | videoFile = open(outputFolder + "/rgb_video.h265", "wb") |
| 287 | rgbQueue = device.getOutputQueue(name="h265-rgb", maxSize=30, blocking=False) |
| 288 | |
| 289 | if args.white_balance or args.exposure or args.sensitivity: |
| 290 | for controlName in cameraControlQueueNames: |
| 291 | cameraControlQueue = device.getInputQueue(name=controlName) |
| 292 | ctrl = depthai.CameraControl() |
| 293 | if args.exposure or args.sensitivity: |
| 294 | if not (args.exposure and args.sensitivity): |
| 295 | raise Exception("If exposure or sensitivity is given, then both of them must be given") |
| 296 | ctrl.setManualExposure(args.exposure, args.sensitivity) |
| 297 | if args.white_balance: |
| 298 | ctrl.setManualWhiteBalance(args.white_balance) |
| 299 | cameraControlQueue.send(ctrl) |
| 300 | |
| 301 | print("Recording to '{0}'".format(config.recordingFolder)) |
| 302 | print("") |
| 303 | if plotter is not None or visualizer is not None: |
| 304 | print("Close the visualization window to stop recording") |
no test coverage detected