First Steps

Testing Image Acquisition via LibArgus

To start the most basic image acquisition pipeline, use the nvarguscamerasrc and nv3dsink elements which are part of the Accelerated GStreamer collection of GStreamer elements:

gst-launch-1.0 nvarguscamerasrc ! nv3dsink

The command opens a window and displays live video from the first connected camera.

If there are multiple cameras in the system, the camera to open can be specified via the sensor-id parameter:

gst-launch-1.0 nvarguscamerasrc sensor-id=1 ! nv3dsink

The image displayed this way is processed by the ISP on the system, with automatic exposure, gain and white balance controls enabled.

nvarguscamerasrc can be parameterized to influence the behavior of the ISP. The list of available options can be displayed by inspecting the element:

gst-inspect-1.0 nvarguscamerasrc

For example, when using a monochrome camera with the ISP, it is recommended to set saturation to 0:

gst-launch-1.0 nvarguscamerasrc saturation=0 ! nv3dsink

Testing Image Acquisition via Video4Linux

It is possible to bypass the ISP and grab raw images from the camera using the Video4Linux API.

This can be tested by using the following command [1]:

v4l2-ctl --set-ctrl=bypass_mode=0 --stream-mmap -d /dev/video0

Setting the bypass_mode control to 0 is required to allow streaming via Video4Linux after the camera has been previously opened by LibArgus.

The -d /dev/video0 part is optional if there is only one video capture device in the system. If there are multiple cameras present, the index can be adjusted to select other cameras.

A < is printed for every image that has been received successfully.

Adjusting Sensor Settings

All sensor settings are configured through Video4Linux controls.

The following example shows how to manually configure the exposure time:

gst-launch-1.0 nvarguscamerasrc aelock=1 ! nv3dsink

Starting the camera with aelock=1 disables automatic gain and exposure control by the ISP.

On a second terminal, it is now possible to configure camera settings [1]:

v4l2-ctl --set-ctrl=exposure=10000
v4l2-ctl --set-ctrl=gain=50

The above commands change the exposure time to 10ms and gain setting to 5.0 dB. The adjustments should be visible in the displayed live image.

The v4l2-ctl program is used for this demonstration, but configuring the sensor settings is obviously also possible programmatically through the V4L2 API.

qv4l2

The qv4l2 application [2] provides a simple way to get an overview of the available sensor settings, and allows changing them interactively.

To open the camera control interface using qv4l2, it has to be opened in raw mode:

qv4l2 -R -d /dev/video0

qv4l2 can be used in parallel with the driver streaming images to a different application. Make sure to use aelock=1 to manually change exposure or gain this way.

Troubleshooting

If something goes wrong, the kernel log usually contains hints about what might have been the cause for the problem:

dmesg