Make a camera for lenticular photography
Installing the Camarray HAT
You can install the required applications and the driver for the quad kit with the shell script
install_pivariety_pkgs.sh
(Listing 1). More information is available in the ArduCam documentation.
Listing 1
Installing the Camarray HAT
$ 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 $ sudo apt-update $ ./install_pivariety_pkgs.sh -p libcamera_dev $ ./install_pivariety_pkgs.sh -p libcamera_apps $ ./install_pivariety_pkgs.sh -p imx519_kernel_driver_low_speed [...] $ libcamera-still --list-cameras 0 : imx519 [4656x3496] (/base/soc/i2c0mux/i2c@1/imx519@1a) Modes: 'SRGGB10_CSI2P' : 1280x720 1920x1080 2328x1748 3840x2160 4656x3496
After the libcamera-hello
command, the camera will respond for a short while. The
libcamera-still --list-cameras
command (Listing 1, last command) checks which cameras are connected. As mentioned before, the software identifies the four sensors as a single device.
Libcamera
The release of the Raspberry Pi OS "Bullseye" operating system in November 2021 fundamentally changed the handling of the camera module. Brand new libcamera commands have since replaced the tried and trusted command-line tools raspistill
and raspivid
. You can still use raspistill
in legacy mode, but makers with more ambitious goals need to get comfortable with the libcamera library.
The transition of the camera control to the Linux kernel's Libcamera driver ensures a standards-compliant solution without proprietary code. New commands such as libcamera-still
or libcamera-vid
are available, and you can build your own apps on the Libcamera code. Extensive documentation can be found on the Raspberry Pi Foundation [6] website.
If you have already worked with raspistill
or raspivid
, it should not be difficult to come to grips quickly with Libcamera. The sample code
$ i2cset -y 10 0x24 0x24 0x00 $ libcamera-still -t 30000 --ev -5 --gain 8--roi 0,0,1,1 --autofocus --info-text "Killepitch" -o testQuadro.jpg
captures the entire image (region of interest, --roi
) in autofocus mode after a preview time of 30 seconds (time out, -t
) with an exposure compensation of -5 (exposure value, --ev
). The --gain 8
parameter corresponds to an ISO value of 800, and the --info-text
flag lets you manipulate the header in the application; the output file is assigned the name testQuadro.jpg
(output, -o
).
Shooting Lenticular Photos
The DIY camera is designed to be point-and-shoot, but the implementation is a little more modest because of the available technology. In my test environment, the system is connected to the local WiFi network behind a mobile router. After switching on the camera, the operating system boots and logs on to the WiFi network. The Virtual Network Computing (VNC) server starts up at boot time.
The same applies to the graphical user interface (GUI; Figure 5), with simple setup functions such as image name, shutter speed, exposure value, preview image, and shutter trigger. The GUI offers more functions, but I will not be using them for the time being. The software, written in Python, uses Guizero with object-oriented controls. It keeps its settings in a dictionary and uses system commands to call the camera functions (see also the "Graphical User Interface" box).
Graphical User Interface
In the download section for this article you will find the lentiCam.py
GUI [7], which I programmed in Python. The dcim/
directory also contains some recent images as examples of the components of a lenticular image.
The images for positions A and B and the individual image tiles end up in the dcim/randomCode/
directory with randomized image labels. The GUI displays the generated random code, which can be changed alphanumerically if required. You decide in advance whether you want to create two, four, or eight exposures. The camera settings can be saved so that you can reuse them for later shots. To align the camera, click the Preview button; status messages are displayed in the header.
Finding a shooting scenario is now the problem. The camera is oriented horizontally. By rule of thumb, the distance to the object is 30 times the distance from the right to the left camera (close-up distance 1/30). Intermediate images split this distance evenly, as you can see in Figure 6, working with four sensors at a distance of 12cm with two intermediate images. This results in a close-up distance of about 3.6m. If you move the lens board by 2cm, you end up with four shots at 8cm apart, and ideally approach the subject to within 2.4m.
These approximations are only rough, based on experience, and by no means binding. The close-up value could well be closer to 1/20 than 1/30. As soon as you move your camera between two positions, you are forced to limit your work to static objects. Manual exposure by shutter speed and gain settings is generally recommended.
After capturing an image, you then need to break the frame down into individual tiles for further processing with the help of the FFmpeg suite or ImageMagick tools, which you can install with:
sudo apt-get install imagemagick sudo apt-get install ffmpeg
To ensure that the images are ordered correctly, add a numerical suffix in the file name.
« Previous 1 2 3 Next »
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Gnome 48 Debuts New Audio Player
To date, the audio player found within the Gnome desktop has been meh at best, but with the upcoming release that all changes.
-
Plasma 6.3 Ready for Public Beta Testing
Plasma 6.3 will ship with KDE Gear 24.12.1 and KDE Frameworks 6.10, along with some new and exciting features.
-
Budgie 10.10 Scheduled for Q1 2025 with a Surprising Desktop Update
If Budgie is your desktop environment of choice, 2025 is going to be a great year for you.
-
Firefox 134 Offers Improvements for Linux Version
Fans of Linux and Firefox rejoice, as there's a new version available that includes some handy updates.
-
Serpent OS Arrives with a New Alpha Release
After months of silence, Ikey Doherty has released a new alpha for his Serpent OS.
-
HashiCorp Cofounder Unveils Ghostty, a Linux Terminal App
Ghostty is a new Linux terminal app that's fast, feature-rich, and offers a platform-native GUI while remaining cross-platform.
-
Fedora Asahi Remix 41 Available for Apple Silicon
If you have an Apple Silicon Mac and you're hoping to install Fedora, you're in luck because the latest release supports the M1 and M2 chips.
-
Systemd Fixes Bug While Facing New Challenger in GNU Shepherd
The systemd developers have fixed a really nasty bug amid the release of the new GNU Shepherd init system.
-
AlmaLinux 10.0 Beta Released
The AlmaLinux OS Foundation has announced the availability of AlmaLinux 10.0 Beta ("Purple Lion") for all supported devices with significant changes.
-
Gnome 47.2 Now Available
Gnome 47.2 is now available for general use but don't expect much in the way of newness, as this is all about improvements and bug fixes.