Camera output
Example showcases DepthAIv3's functionality to request an output stream directly from the Camera node, instead of having to create and configure an ImageManip node.Python
1output = camera_node.requestOutput(
2 size=(640, 480),
3 type=dai.ImgFrame.Type.BGR888p,
4 resize_mode=dai.ImgResizeMode.CROP,
5 fps=15
6)
CROP
, STRETCH
, or LETTERBOX
, which come into play if there's a missmatch between sensor aspect ratio (AR) and requested aspect ratio. For more information (pros/cons of each) check Input frame AR missmatch documentation.Camera Multiple Outputs example showcases how to request multiple outputs from the Camera node.Setup
This example requires the DepthAI v3 API, see installation instructions.Pipeline
Source code
Python
C++
Python
PythonGitHub
1#!/usr/bin/env python3
2
3import cv2
4import depthai as dai
5
6# Create pipeline
7with dai.Pipeline() as pipeline:
8 # Define source and output
9 cam = pipeline.create(dai.node.Camera).build()
10 videoQueue = cam.requestOutput((640,400)).createOutputQueue()
11
12 # Connect to device and start pipeline
13 pipeline.start()
14 while pipeline.isRunning():
15 videoIn = videoQueue.get()
16 assert isinstance(videoIn, dai.ImgFrame)
17 cv2.imshow("video", videoIn.getCvFrame())
18
19 if cv2.waitKey(1) == ord("q"):
20 break
Need assistance?
Head over to Discussion Forum for technical support or any other questions you might have.