The argus_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:
The following diagram shows the result of the compositing the camera output. If Camera 1-5 does not exist, the corresponding window is absent.

This sample requires:
$ cd 13_argus_multi_camera $ make
$ ./argus_multi_camera [-n <number of cameras>]
The following image shows the movement of data through the sample.

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 |
|---|---|
| NvBufSurfaceAllocate() | Creates a DMA buffer. The sample uses this function to create the buffer for the composited image and for the input images. |
| NvBufSurfaceDestroy() | Destroys DMA buffers. |
| NvBufSurfTransformMultiInputBufCompositeBlend() | 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). |