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.
$ cd 12_camera_v4l2_cuda $ make
Enter:
$ ./camera_v4l2_cuda -d /dev/video0 -s 1280x720 -f YUYV -c
The -c option enables CUDA processing.
Or enter:
$ ./camera_v4l2_cuda -d /dev/video0 -s 640x480 -f YUYV -n 30 -c
The -n option saves the n-th frame before video converter processing.
-h
option.The following diagram shows the flow of data through this sample.
The sample defines the structure and functions listed in the following tables.
Structure | Description |
---|---|
context_t | Global structure to save the context for V4L2 camera, CUDA and EglRenderer. |
Function | Description |
---|---|
init_components | Initializes V4L2 camera and EglRenderer. |
prepare_buffers | Allocates buffers for the capture_plane. Then, it shares the buffers with V4L2 Camera, CUDA, and EglRenderer. |
start_stream | Starts V4L2 camera streaming. |
start_capture | Main thread to enqueue and dequeue buffers. |
stop_stream | Stops V4L2 camera streaming. |