How can I display the output (a preview or video) as an inline video in a Jupyter Notebook? The 4K RGB MobileNetSSD sample works just fine with the external windows, but I want to access JupyterLab across the network. In order for this to work properly, I'll need the video to display in the notebook. Otherwise the notebook server will be showing a window I can't see or close.
I'm also wondering if there are other best practices for DepthAI in JupyterLab. For example, you should always explicitly clean up your code, or your script will hang and crash the kernel. See the last 3 lines:
import depthai as dai
pipeline = dai.Pipeline()
camRgb = pipeline.createColorCamera()
camRgb.setPreviewSize(300, 300)
camRgb.setBoardSocket(dai.CameraBoardSocket.RGB)
camRgb.setResolution(dai.ColorCameraProperties.SensorResolution.THE_1080_P)
camRgb.setInterleaved(False)
camRgb.setColorOrder(dai.ColorCameraProperties.ColorOrder.RGB)
xoutRgb = pipeline.createXLinkOut()
xoutRgb.setStreamName("rgb")
camRgb.preview.link(xoutRgb.input)
with dai.Device(pipeline) as device:
device.startPipeline()
qRgb = device.getOutputQueue(name="rgb", maxSize=4, blocking=False)
print('Press \'Q\' to Quit')
while True:
inRgb = qRgb.get()
cv2.imshow("bgr", inRgb.getCvFrame())
if cv2.waitKey(1) == ord('q'):
break
device.close()
cv2.destroyAllWindows()
del pipeline
Any tips are greatly appreciated!
-Drew