Jetson Linux API Reference

32.7.1 Release
13_multi_camera (multi image capture & composite)


The multi_camera sample captures multiple cameras and composites them to one frame. After compositing the images, the sample renders the composited frame on the display.

The sample uses the multi-session feature in libargus to capture several cameras simultaneously. It uses cameras as follows:

  • Camera 0 is the base camera, which is used as background in the final picture.
  • Camera 1-N (N <=5) is used for window overlays. The sample places overlays on top of the background, to create the Picture in Picture layout.

The following diagram shows the result of the compositing the camera output. If Camera 1-5 does not exist, the corresponding window is absent.

Composited Display

This sample requires:

  • Camera board with multiple sensors.
  • Display.

Building and Running


To build

  • Enter:
       $ cd 13_multi_camera
       $ make

To run

  • Enter:
     $ ./multi_camera [-n <number of cameras>]


The following image shows the movement of data through the sample.

Block Diagram

Key Structure and Classes

The following tables describe the key NvMedia declarations that the sample uses.

Class and Method Description
NvEglRenderer The class contains elements and functions to render frames to EGL window.
NvEglRenderer::render() Renders a buffer from the file descriptor to an EGL window.

Functions Description
NvBufferCreateEx() Creates a DMA buffer. The sample uses this function to create the buffer for the composited image and for the input images.
NvBufferDestroy() Destroys DMA buffers.
NvBufferComposite() Composites several input buffers to one DMA buffer.

For guidance on the libargus APIs, see Libargus Camera API.

The following table describes the key sample elements.

Element Description
Execute Producer thread that creates output streams and submits capture requests.
ConsumerThread::threadExecute Consumer thread that reads frames from multiple cameras.
CaptureHolder Class that represents a single camera. This class contains all Libargus Camera API resources to capture frames from that camera.
CaptureHolder::initialize Method that creates and initializes libargus resources for a single camera, including Argus::ICaptureSession, Argus::OutputStream, and Argus::Request (capture request).