L4T Multimedia API Reference

28.2 Release

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
multimedia_api/ll_samples/docs/l4t_mm_13_multi_camera.md
Go to the documentation of this file.
1 Copyright (c) 2016-2018, NVIDIA CORPORATION. All rights reserved.
2 <!-- Sample is in the backend dir. -->
3 
4 @page nvvid_13_multi_camera_group 13_multi_camera
5 @{
6 
7  - [Overview](#overview)
8  - [Building and Running](#build_and_run)
9  - [Flow](#flow)
10  - [Key Structure and Classes](#key)
11 
12 - - - - - - - - - - - - - - -
13 <a name="overview">
14 ## Overview ##
15 
16 The multi_camera sample captures multiple cameras and composites them to one frame.
17 After compositing the images, the sample renders the composited frame on the display.
18 
19 The sample uses the multi-session feature in libargus to capture several
20 cameras simultaneously. It uses cameras as follows:
21 - Camera 0 is the base camera, which is used as background in the final picture.
22 - Camera 1-N (N <=5) is used for window overlays. The sample places overlays
23  on top of the background, to create the Picture in Picture layout.
24 
25 The following diagram shows the result of the compositing the camera output.
26 If Camera 1-5 does not exist, the corresponding window is absent.
27 
28 ![Composited Display](l4t_mm_13_multi_camera_pip.png)
29 
30 This sample requires:
31 * Camera board with multiple sensors.
32 * Display.
33 
34 <a name="build_and_run">
35 ## Building and Running ##
36 
37 #### Prerequisites ####
38 
39 * You have followed Steps 1-3 in @ref mmapi_build.
40 
41 ### To build
42 
43 * Enter:
44 
45  $ cd 13_multi_camera
46  $ make
47 
48 ### To run
49 
50 * Enter:
51 
52  $ ./multi_camera [-n <number of cameras>]
53 
54 <a name="flow">
55 - - - - - - - - - - - - - - -
56 ## Flow
57 
58 The following image shows the movement of data through the sample.
59 
60 ![Block Diagram](l4t_mm_13_multi_camera.png)
61 
62 - - - - - - - - - - - - - - -
63 <a name="key">
64 ## Key Structure and Classes ##
65 
66 The following tables describe the key NvMedia declarations that the sample uses.
67 
68 |Class and Method|Description|
69 |-------|-----------|
70 |#NvEglRenderer | The class contains elements and functions to render frames to EGL window.|
71 |NvEglRenderer::render() | Renders a buffer from the file descriptor to an EGL window.|
72 
73 <br>
74 
75 |Functions|Description|
76 |-------|-----------|
77 |NvBufferCreateEx() | Creates a DMA buffer. The sample uses this function to create the buffer for the composited image and for the input images.|
78 |NvBufferDestroy() | Destroys DMA buffers.|
79 |NvBufferComposite() | Composites several input buffers to one DMA buffer.|
80 
81 For guidance on the libargus APIs, see @ref LibargusAPI.
82 
83 The following table describes the key sample elements.
84 
85 |Element|Description|
86 |-------|-----------|
87 |Execute | Producer thread that creates output streams and submits capture requests.|
88 |ConsumerThread::threadExecute |Consumer thread that reads frames from multiple cameras.|
89 |CaptureHolder | Class that represents a single camera. This class contains all @ref LibargusAPI resources to capture frames from that camera.|
90 |CaptureHolder::initialize | Method that creates and initializes libargus resources for a single camera, including Argus::ICaptureSession, Argus::OutputStream, and Argus::Request (capture request).|
91 
92 
93 
Interface to the core CaptureSession methods.
int NvBufferComposite(int *src_dmabuf_fds, int dst_dmabuf_fd, NvBufferCompositeParams *composite_params)
This method is used to composite multiple input DMA buffers to one output DMA buffer.
NvEglRenderer is a helper class for rendering using EGL and OpenGL ES 2.0.
Definition: NvEglRenderer.h:74
int NvBufferDestroy(int dmabuf_fd)
This method must be used for destroying hw_buffer.
int NvBufferCreateEx(int *dmabuf_fd, NvBufferCreateParams *input_params)
Use this method to allocate HW buffer.
int render(int fd)
Renders a buffer.