Recently, Arducam came up with a new, awesome camera. It’s much better than the “quality camera” of raspberry Pi, and it has autofocus!

Even better, you can buy it with a pan-tilt engine together.

But obviously not everything is perfect. For this one to run with OpenCV and python, there’s a VERY involved process which can be a bit daunting.
First: Download this version of Raspbian and DO NOT UPDATE THE KERNEL: https://downloads.raspberrypi.org/raspios_arm64/images/raspios_arm64-2022-01-28/2022-01-28-raspios-bullseye-arm64.zip
Install Raspberry OS normally. In it,
sudo apt install openssl-dev \
flex \
bison \
libgstreamer1.0-dev \
libgstreamer-plugins-base1.0-dev \
libgstreamer-plugins-bad1.0-dev \
gstreamer1.0-plugins-ugly \
gstreamer1.0-tools \
gstreamer1.0-gl \
gstreamer1.0-gtk3
wget -O install_pivariety_pkgs.sh https://github.com/ArduCAM/Arducam-Pivariety-V4L2-Driver/releases/download/install_script/install_pivariety_pkgs.sh
chmod +x install_pivariety_pkgs.sh
./install_pivariety_pkgs.sh -p libcamera_dev
./install_pivariety_pkgs.sh -p libcamera_apps
./install_pivariety_pkgs.sh -p imx519_kernel_driver
Here it will reboot.
After reboot,
git clone https://github.com/umlaeute/v4l2loopback.git # I am using the tag 0.12.5
cd v4l2loopback
make clean && make
make && sudo make install
sudo depmod -a
cd
git clone git://linuxtv.org/libcamera.git
sudo modprobe v4l2loopback video_nr=3
cd libcamera # Installation using deb does not need to be executed
export GST_PLUGIN_PATH=$(pwd)/build/src/gstreamer # Installation using deb does not need to be executed
gst-launch-1.0 libcamerasrc ! 'video/x-raw,width=1920,height=1080' ! videoconvert ! tee ! v4l2sink device=/dev/video3
This will be running on a window. You need a second terminal to do something else.
For python:
cd
python3 -m venv --system-site-packages py3-cv2
source py3-cv2/bin/activate
pip install opencv-contrib-python
For every python code one should activate the previous virtual environment with a source ~/py3-cv2/bin/activate
, so the opencv is found. I prefer to not install random stuff on .local.
Hope they release normal drivers for it instead of this.
Turns out that using libcamerify
is easier than all of this.