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_v4l2_cam_cuda.md
Go to the documentation of this file.
1 Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
2 <!-- Sample is in the camera_v4l2_cuda directory. -->
3 
4 @page l4t_mm_v4l2_cam_cuda_group 12_camera_v4l2_cuda
5 @{
6 
7  - [Overview](#overview)
8  - [Building and Running](#build_and_run)
9  - [Flow](#flow)
10  - [Key Structure and Functions](#key)
11 
12 <a name="overview">
13 - - - - - - - - - - - - - - -
14 ## Overview ##
15 
16 This sample demonstrates how to capture images from a V4L2 YUV type of camera
17 and share the image stream with NVIDIA<sup>&reg;</sup> CUDA<sup>&reg;</sup>
18 engines to draw a black box on the upper left corner.
19 
20 <a name="build_and_run">
21 - - - - - - - - - - - - - - -
22 ## Building and Running ##
23 
24 #### Prerequisites ####
25 
26 * You have followed Steps 1-3 in @ref mmapi_build.
27 * If you are building from your host Linux PC (x86), you have
28  followed Step 4 in @ref mmapi_build.
29 * You have the following hardware:
30  * V4L2 Camera (USB or YUV Camera with the format YUYV/YVYU/UYVY/VYUY)
31  * Display
32 
33 ### To build:
34 * Enter:
35 
36  $ cd 12_camera_v4l2_cuda
37  $ make
38 
39 ### To run
40 * Enter:
41 
42  $ ./camera_v4l2_cuda -d /dev/video0 -s 1280x720 -f YUYV -c
43 
44  The -c option enables CUDA processing.
45 * Or enter:
46 
47  $ ./camera_v4l2_cuda -d /dev/video0 -s 640x480 -f YUYV -n 30 -c
48 
49  The -n option saves the n-th frame before video converter processing.
50 
51 ### To view supported options
52 * Use the `-h` option.
53 
54 <a name="flow">
55 - - - - - - - - - - - - - - -
56 ## Flow
57 The following diagram shows the flow of data through this sample.
58 
59 #### Block Diagram ####
60 ![Block Diagram](l4t_mm_v4l2_camera.png)
61 
62 
63 <a name="key">
64 - - - - - - - - - - - - - - -
65 ## Key Structure and Functions ##
66 
67 The sample defines the structure and functions listed in the following tables.
68 
69 |Structure|Description|
70 |-------|-----------|
71 |context_t|Global structure to save the context for V4L2 camera, CUDA and EglRenderer.|
72 <br>
73 
74 |Function|Description|
75 |-------|-----------|
76 |init_components|Initializes V4L2 camera and EglRenderer.|
77 |prepare_buffers|Allocates buffers for the capture_plane. Then, it shares the buffers with V4L2 Camera, CUDA, and EglRenderer.|
78 |start_stream|Starts V4L2 camera streaming.|
79 |start_capture|Main thread to enqueue and dequeue buffers.|
80 |stop_stream|Stops V4L2 camera streaming.|
81 
82 
83 
84 
85 
86 
87 
88 
89