L4T Multimedia API Reference

27.1 Release

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
V4L2 Camera with CUDA

Special Requirements

  • V4L2 Camera (USB or YUV Camera with the format YUYV/YVYU/UYVY/VYUY)
  • Display

Overview

This sample demonstrates how to capture images from a V4L2 YUV type of camera and share the image stream with NVIDIA® CUDA® engines to draw a black box on the upper left corner.

Block Diagram

Block Diagram

Key Structure and Functions

StructureDescription
context_tGlobal structure to save the context for V4L2 camera, VIC, CUDA and EglRenderer.
FunctionDescription
init_componentsInitializes V4L2 camera, VIC, and EglRenderer.
prepare_buffersAllocates buffers for VIC output_plane and capture_plane. Then, it shares the buffers with V4L2 Camera, CUDA, and EglRenderer.
start_streamStarts V4L2 camera streaming and VIC.
conv_capture_dqbuf_thread_callbackProcesses the de-queued buffer with CUDA and renders it to the display.
start_captureMain thread to enqueue and dequeue buffers.
stop_streamStops V4L2 camera streaming.

Command Line Options

./camera_v4l2_cuda [OPTIONS]

For example:

./camera_v4l2_cuda -d /dev/video0 -s 640x480 -f YUYV -n 30 -c

Use the -h option to view the currently supported options.