L4T Multimedia API Reference

27.1 Release

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Camera JPEG Capture Sample

Overview

This sample shows how to use libargus to create camera objects and interface as frame producer so either EGL image renderer can display, preview, or perform image capture to a JPEG file.

Prerequisites

Before running the sample, you must have the following:

  • README that provides details on the environment requirements to build and run the sample
  • A camera

Additional Details

The sample uses producer and consumer model to establish frame flow from camera object producing frame output to consumer connecting EGLstream buffer for rendering preview mode.

The programming model is quite straightforward and efficient once you are familiar with it.

The API is frame-based cross-platform user mode API. The design is to ensure zero buffer copy when it comes to consuming output frame.


Key Structure and Classes

Regarding libargus and EGLStream, please refer to libargus document.

ClassesDescription
class NvEGLRender The class contains elements and functions to render frames to EGL window.
class NvJpegEncoder The class contains elements and functions to encode JPEG images.

NvEGLRender is the class that packages all the functions for video rendering. Key members used in the sample are as follows:

NvEGLRender Description
render Render the FD to an EGL window.

NvJpegEncoder is the class that packages all the functions for JPEG encoding. Key members used are:

NvV4l2ElementPlane Description
encodeFromFd Encode form FD of buffer exported by V4L2 element.