1 Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
2 <!-- Sample is in the camera_v4l2_cuda directory. -->
4 @page l4t_mm_v4l2_cam_cuda_group 12_camera_v4l2_cuda
7 - [Overview](#overview)
8 - [Building and Running](#build_and_run)
10 - [Key Structure and Functions](#key)
13 - - - - - - - - - - - - - - -
16 This sample demonstrates how to capture images from a V4L2 YUV type of camera
17 and share the image stream with NVIDIA<sup>®</sup> CUDA<sup>®</sup>
18 engines to draw a black box on the upper left corner.
20 <a name=
"build_and_run">
21 - - - - - - - - - - - - - - -
22 ## Building and Running ##
24 #### Prerequisites ####
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)
36 $ cd 12_camera_v4l2_cuda
42 $ ./camera_v4l2_cuda -d /dev/video0 -s 1280x720 -f YUYV -c
44 The -c option enables CUDA processing.
47 $ ./camera_v4l2_cuda -d /dev/video0 -s 640x480 -f YUYV -n 30 -c
49 The -n option saves the n-th frame before video converter processing.
51 ### To view supported options
52 * Use the `-h` option.
55 - - - - - - - - - - - - - - -
57 The following diagram shows the flow of data through
this sample.
59 #### Block Diagram ####
60 
64 - - - - - - - - - - - - - - -
65 ## Key Structure and Functions ##
67 The sample defines the structure and functions listed in the following tables.
69 |Structure|Description|
71 |context_t|Global structure to save the context
for V4L2 camera, VIC, CUDA and EglRenderer.|
74 |Function|Description|
76 |init_components|Initializes V4L2 camera, VIC, and EglRenderer.|
77 |prepare_buffers|Allocates buffers
for VIC output_plane and capture_plane. Then, it shares the buffers with V4L2 Camera, CUDA, and EglRenderer.|
78 |start_stream|Starts V4L2 camera streaming and VIC.|
79 |conv_capture_dqbuf_thread_callback|Processes the de-queued buffer with CUDA and renders it to the display.|
80 |start_capture|Main thread to enqueue and dequeue buffers.|
81 |stop_stream|Stops V4L2 camera streaming.|