1 Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
2 <!-- Sample is in the frontend directory. -->
4 @page l4t_mm_camcap_tensorrt_multichannel_group Frontend
7 - [Overview](#overview)
8 - [Building and Running](#build_and_run)
10 - [Key Classes and Methods](#key)
12 #### Requirements ####
17 - - - - - - - - - - - - - - -
20 This sample demonstrates video capture
for four video streams coming directly
21 from camera sensors, where the streams have different resolutions.
22 Three of the streams go through the
23 encoding process and are saved as H.264 or H.265 files. The fourth stream
24 provides full resolution and uses NVIDIA<sup>®</sup> TensorRT<sup>&tm;</sup>
25 to perform
object detection. If target
object is detected, it will draw a
26 bounding box around the
object on the frame. Finally, the frame with the
27 bounding box is rendered on the display and simultaneously encoded as an H.264
30 <a name=
"build_and_run">
31 - - - - - - - - - - - - - - -
32 ## Building and Running ##
35 * You have followed Steps 1-3 in @ref mmapi_build.
38 1. Ensure the following variable is set to 1 by making the
39 following change in the Makefile:
50 $ ./frontend --deploy ../../data/Model/GoogleNet_three_class/GoogleNet_modified_threeClass_VGA.prototxt \
51 --model ../../data/Model/GoogleNet_three_class/GoogleNet_modified_threeClass_VGA.caffemodel \
57 ### To view command-line options:
65 - - - - - - - - - - - - - - -
67 The following diagrams illustrate the flow of data through
this sample.
69 #### Detailed Buffer Management ####
70 
72 #### Buffer Flow of the Frontend Using TensorRT ####
73 
75 $ ./frontend --deploy ../../data/Model/GoogleNet_three_class/GoogleNet_modified_threeClass_VGA.prototxt \
76 --model ../../data/Model/GoogleNet_three_class/GoogleNet_modified_threeClass_VGA.caffemodel
79 - - - - - - - - - - - - - - -
80 ## Key Classes and Methods ##
82 For information on libargus, see @ref LibargusAPI. For information on EGLStream, see documentation on the Khronos web site.
84 ### StreamConsumer Class ###
86 The sample defines `StreamConsumer` as an abstracted
class. It is not imported from other libraries.
90 |StreamConsumer|A base
class of the libargus `OutputStream` consumer. It contains a dedicated thread to poll frames from Argus::OutputStream.|
92 The following table describes key `StreamConsumer` members.
96 |setOutputStream|Sets OutputStream which be used to create the FrameConsumer.|
97 |getSize|Gets stream resolution.|
98 |threadInitialize|Virtual method that initializes the consumer thread.|
99 |threadExecute|Virtual method that manages the thread loop.|
100 |threadShutdown|Virtual method that destroys the consumer thread.|
101 |processFrame|Virtual method that handles one frame.|
103 ### VideoEncoder Class ###
105 The sample defines `VideoEncoder` as an abstracted class. It is not imported from other libraries.
108 |-------|-----------|
109 |VideoEncoder|This is a utility class to simplify the use of V4L2 video encoder.|
111 The following table describes key `VideoEncoder` members.
113 |Members|Description|
114 |-------|-----------|
115 |VideoEncoder|Constructor in which to specify resolution, output video filename, and select encoding format.|
116 |initialize|Initialize video encoder and stream consumer.|
117 |shutdown|Destroy resources.|
118 |setBufferDoneCallback|Set callback to return buffer to caller.|
119 |encodeFromFd|Feed the encoder with a new buffer.|
121 ### VideoStreamConsumer Class ###
123 The sample defines `VideoStreamConsumer` as an abstracted class. It is not imported from other libraries.
126 |-------|-----------|
127 |VideoStreamConsumer|This class is a derived class of StreamConsumer to support video encoding. It reuses the VideoEncoder object for video encoding.|
129 The following table describes key `VideoStreamConsumer` members.
131 |Members|Description|
132 |-------|-----------|
133 |VideoEncodeStreamConsumer|Constructor in which to specify the name of the consumer, output video filename and select encoding format.|
134 |threadInitialize|Initializes the video encoder and stream consumer.|
135 |threadShutdown|Destroys resources.|
136 |processFrame|Receives frames and pushes them to the encoder.|
138 ### TRTStreamConsumer Class ###
140 The sample defines `TRTStreamConsumer` as an abstracted class. It is not imported from other libraries.
144 |-------|-----------|
145 |TRTStreamConsumer|This class is a derived class of StreamConsumer to support TensorRT (GIE) inference. It also has a VideoEncoder object to support video encoding.|
147 The following table describes key `TRTStreamConsumer` members.
149 |Members|Description|
150 |-------|-----------|
151 |TRTStreamConsumer|Constructor in which to specify the name of the consumer, output video filename and select encoding format.|
152 |threadInitialize|Initializes TensorRT context, video encoder and stream consumer.|
153 |threadShutdown|Destroys resources.|
154 |processFrame|Receives frames and prepares them for the TensorRT inference.|
155 |setDeployFile|Sets the deploy file for building the TensorRT context.|
156 |setModelFile|Sets the model file for building the TensorRT context.|
157 |RenderThreadProc|Loops to draw the bounding box, render the frame, and encode the video.|
158 |TRTThreadProc|Loops to do the TensorRT inference.|