1. Home
  2. Docs
  3. Camera for Jetson Nano
  4. MIPI Camera Modules for Jetson Nano
  5. 2. Camera Demonstration

2. Camera Demonstration

1.Hardware connection

The Arducam Project Jetvariety consists of three parts:

  1. The MIPI Camera Module
  2. The camera driver
  3. 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

ls /dev/video*

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 v4l2-utils

Determine which format and resolution the current camera supported:

v4l2-ctl --list-formats-ext
v4l2 ctl

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.

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.

3.1 Install v4l2 python module

for Python3.x:

wget https://bootstrap.pypa.io/get-pip.py  
sudo python3 get-pip.py  
sudo pip3 install v4l2  

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:

python import v4l2 error

You can refer to this link to fix this bug: v4l2 throws a TypeError when imported in Python 3.5

for Python2.7:

wget https://bootstrap.pypa.io/get-pip.py  
sudo python get-pip.py  
sudo pip install v4l2  

Note

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  
the parameters of arducam python displayer

3.4 Run the Demo

python arducam_displayer.py

Was this article helpful to you? Yes No