Fig.1. Raspberry Pi 4 model B
All current XIMEA USB cameras are compatible with the Raspberry Pi 4 Model B.
The XIMEA software package for Linux can be installed on the Raspberry Pi, but (depending on the choice of the operating system) the XIMEA CamTool may not be available.
The performance of the Raspberry Pi depends on the camera model as well as on the application.
It may not be possible to reach the advertised frame rate of a camera.
The following hardware was used during testing:
It is possible to install the XIMEA software package on a system running the official Raspberry Pi OS, but there are some restrictions.
At the time of testing only the 32bit version of this OS has been officially released.
The XIMEA CamTool is not supported on 32bit operating systems, so it couldn't be used.
Ubuntu 21.04 (64 bit) is also available for the Raspberry Pi 4.
All components of the XIMEA software package including CamTool can be used on a Raspberry Pi when using Ubuntu 21.04 (64 bit).
Other distribution may also work with XIMEA cameras, but it was not tested.
¶Prerequisites
The tool from the official Raspberry Pi website can be used to prepare a Micro SD card with the operating system.
The following instructions assume that you have used this method to install Ubuntu 21.04 (64bit) and no other software has been installed on the system.
A working internet connection will be necessary to run all necessary libraries.
Make sure all packages installed on your system are up-to-date by running the following commands:
sudo apt update
sudo apt upgrade
Either download the XIMEA software package for Linux from the XIMEA website:
https://www.ximea.com/support/projects/apis/wiki/XIMEA_Linux_Software_Package/#Installation
Or run the following command:
wget https://kb.ximea.com/downloads/recent/XIMEA_Linux_ARM_SP.tgz
Afterward, unpack the installer and run it:
tar xzf XIMEA_Linux_ARM_SP.tgz
cd package
./install
You will need "sudo" privileges to run the installer.
The default memory limit for buffers allocated for USB devices (usually 16MB) is too low for XIMEA USB cameras.
This can be changed permanently following these steps:
1. Open the file /boot/firmware/cmdline.txt in your preferred text editor
2. Append the following (in the same line):
usbcore.usbfs_memory_mb=0
3. Reboot the system
4. Check if the changes are applied. The following command should print 0:
cat /sys/module/usbcore/parameters/usbfs_memory_mb
¶Running xiSample
After installing the XIMEA software package and increasing the USB memory limit, you can connect the camera and run this basic example to see if the camera is working:
/opt/XIMEA/bin/xiSample
Running CamTool
The XIMEA CamTool has some additional dependencies that may not be installed yet.
You can install them using the following command:
sudo apt install libpcre16-3
Afterward, you can launch the XIMEA CamTool:
/opt/XIMEA/bin/xiCamTool
Running xiApiPlusOpenCV
The xiApiPlusOpenCV example located in /opt/XIMEA/examples/xiApiPlusOpenCV is available as source code and needs to be compiled.
It requires some build tools as well as OpenCV to be installed.
sudo apt install build-essential libopencv-dev
The current version of OpenCV (4.5) requires a slightly different include path compared to the version originally used in this example.
To be able to compile the example with this version, open the Makefile in your preferred editor and change all occurrences of /usr/local/include/ to /usr/include/opencv4.
Afterward, you can compile and run the example:
sudo make
./xiApiPlusOpenCVExample
USB bandwidth is consistently measured as 392 MByte/s which is slower than some other USB controllers, but should generally not be an issue.
Frame rate in RAW8
With the image data format set to RAW8, minimal exposure and bandwidth limited to 95% of the available bandwidth, it was possible to get very close to the specified full frame rate (according to the XIMEA technical manual) and in some cases even exceed it.
Note that during this test, no image processing, rendering or recording was performed.
Camera model | Resolution | Measured frame rate | Spec. frame rate |
MU181CR-ON | 18.1 Mpix | 20.7 Fps | 21.9 Fps |
MQ013MG-E2 | 1.3 Mpix | 61.6 Fps | 61 Fps |
MQ013MG-ON* | 1.3 Mpix | 211.8 Fps | 210 Fps |
MQ022CG-CM | 2.1 Mpix | 166.2 Fps | 170 Fps |
MQ042MG-CM | 4.1 Mpix | 88.4 Fps | 90 Fps |
MC050CG-SY | 5 Mpix | 72.4 Fps | 76 Fps |
MC124MG-SY | 12.4 Mpix | 29.8 Fps | 31 Fps |
MC245CG-SY | 24.5 Mpix | 14.8 Fps | 16.2 Fps |
*With ZeroROT enabled