CameraComponent

CameraComponent abstracts ColorCamera and MonoCamera nodes and supports mocking the camera when recording is passed during OakCamera initialization. When using Replaying feature, this component will mock the camera by sending frames from the host to the OAK device (via XLinkIn node).

Usage

from depthai_sdk import OakCamera

with OakCamera() as oak:
    # Create color camera
    color = oak.create_camera('color')

    # Visualize color camera frame stream
    oak.visualize(color.out.main, fps=True)
    # Start the pipeline, continuously poll
    oak.start(blocking=True)

Component outputs

  • main - Uses one of the outputs below.

  • camera - Default output. Streams either ColorCamera’s video (NV12) or MonoCamera’s out (GRAY8) frames. Produces FramePacket.

  • replay - If we are using Replaying feature. It doesn’t actually stream these frames back to the host, but rather sends read frames to syncing mechanism directly (to reduce bandwidth by avoiding loopback). Produces FramePacket.

  • encoded - If we are encoding frames, this will send encoded bitstream to the host. When visualized, it will decode frames (using cv2.imdecode for MJPEG, or pyav for H.26x). Produces FramePacket.

Reference