Skip to content

Quick start

Access the camera with Gstreamer

You can refer to the following doc to access the cameras with Gstreamer:

Quick start

Arducam Displayer Tools

Install the driver

Step1. Download automatic installation script

wget https://github.com/ArduCAM/MIPI_Camera/releases/download/v0.0.3/install_full.sh

Step2. Install the driver

chmod +x install_full.sh
./install_full.sh -m arducam

reboot

Enter y to reboot your device.

How to use the camera

Some of the video preview software tools like VLC player only supports formats like GRAY, YUV etc., it might not support Bayer format. In this case we provide a python demo script to illustrate how to open and preview our cameras with OpenCV. In the demo code the most important three steps should be followed.

Note

The official SD Card Image provided by Nvidia comes with a Python version of OpenCV version 4.1.1.

  • Designate the VideoCapture apiPreference parameter as CAP_V4L2
  • Disable the RGB conversion
  • Shift the data bit to match with the camera real output bit width and do color conversion when necessary.

1. install the v4l2 python module

for python 3.x:

wget https://bootstrap.pypa.io/get-pip.py  

python1

After you type the following command and press【Enter】, it will take several minutes to finish downloading.

sudo python3 get-pip.py

python2

python3

sudo pip3 install v4l2-fix

python4

Note

The V4L2 of Python3.x has a known bug that requires a manual fix, and the following error occurs when you import the v4l2 module into Python3.x:

python5

You can refer to this link to fix this bug:

https://bugs.launchpad.net/python-v4l2/+bug/1664158

2. Download the demo code

git clone https://github.com/ArduCAM/MIPI_Camera.git

python6

python7

3. Check whether the camera is detected

ls /dev/video0

python8

4. Check the video format supported

v4l2-ctl --list-formats-ext

5. Display images in real time

If accessing Jetson via remote software (e.g., MobaXterm), the following command (executed only once) is required to display the image.

export DISPLAY=:0.0

Enter program directory:

cd MIPI_Camera/Jetson/Jetvariety/example/
Check the help message of the parameters:

python arducam_displayer.py -d 0

Run the demo:

python arducam_displayer.py

Read the sensor register

Arducam MIPI Camera driver for Jetson Nano support accessing the registers of the camera sensor and driver board by ioctl. Refer to rw_sensor.c and rw_sensor.py for an example of how to use it.

  • rw_sensor.py help file

rw_sensor_help

  • rw_sensor.py demo

Read a single register

python rw_sensor.py -d 0 -r 0x3500

Read multiple registers

python rw_sensor.py -d 0 -r 0x3500 0x3501 0x3502

python rw_sensor.py -d 0 -r 0x3500 0x3501 0x3502

python rw_sensor.py -d 0 -r 0x3500 -v 0x01

Write multiple registers

python rw_sensor.py -d 0 -r 0x3500 0x3501 -v 0x01 0x02

Display in VLC

Some cameras support using VLC to capture images. But please notice that some formats will not be supported by VLC.

Preparation

Please first check if your camera formats can be supported.

# input the command to check the camera formats
sudo apt-get install -y v4l-utils
v4l2-ctl --list-formats-ext

Use VLC

Open VLC media player
VLC1

Display the image

Press Ctrl+C

VLC2

【Video device name】→ select "/dev/video0"→ click 【Play】.

VLC3

Adjust exposure, gain, and frame rate

Press Ctrl+E, drag the sliders at "Exposure", "Gain" and "Frame_rate" to make adjustments under the "v4l2 control" tab.

VLC4

Next

Access Global Shutter Camera using external trigger snapshot mode