- 1.Hardware connection
- 2.Check and validate the camera connection
- 3.Run the camera
- 4.Read the sensor register
The Arducam Project Jetvariety consists of three parts:
- The MIPI Camera Module
- The camera driver
- The Jetvariety adapter board
Therefore, the MIPI camera module alone will not directly work with the Jetson Nano, and the adapter is required. You should connect the MIPI camera module to the adapter, and then the adapter to the MIPI CSI slot of the Jetson Nano.
2.Check and validate the camera connection
Make sure you have installed the camera driver before you proceed.
2.1 Check whether the camera is detected
You should find new video devices from /dev/videoX (X might vary from 0 ~ N).
2.2 Check the video format supported
Install the v4l-utils package:
sudo apt-get install v4l-utils
Determine which format and resolution the current camera supported：
3.Run 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.
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.
3.1 Install v4l2 python module
wget https://bootstrap.pypa.io/get-pip.py sudo python3 get-pip.py sudo pip3 install v4l2-fix
wget https://bootstrap.pypa.io/get-pip.py sudo python get-pip.py sudo pip install v4l2
If you want to install pip for both python3.x and python2.7, install python3 pip first, then python2.7 pip, otherwise the pip command will be overwritten by pip3. You can use
pip --version and
pip3 --version to check if the pip version is correct.
3.2 Download the demo code
git clone https://github.com/ArduCAM/MIPI_Camera.git cd MIPI_Camera/Jetson/Jetvariety/example
3.3 Check the help message of the parameters
python arducam_displayer.py -d 0
3.4 Run the Demo
4.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.py for an example of how to use it.
4.1 rw_sensor.py help file
4.2 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
Write a single register
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