Continuous shooting for detailed photography
Exposure Control
In conventional photography, exposure is controlled by aperture, ISO, and shutter speed, plus white balance and color palette. Tabletop photography is mostly about static scenes, so you do not need to influence exposure time directly.
Despite the webcam's good adaptation to ambient light, you will want to use several light sources to ensure optimal illumination of the scene. You can do without the automatic mode, especially for continuous shooting. If possible, leave brightness, contrast, saturation, and gain (comparable to ISO) at medium values.
Color adjustment is mainly achieved with white balance; make sure you do not tweak the settings too quickly. Gradual, small changes will give you the best results. Figure 8 shows an example of the differences between automatic and manual white balance.
The automatic white balance delivers very cold colors, and the break in the background can still be seen. A color temperature of 5500 Kelvin improves the white areas in particular. The background is also now evenly black thanks to the manual white balance. Some caution is required with saturation; otherwise, you can easily go too far.
Processing Continuous Shooting
After you have completed the image settings, let the camera do its work. In the example, I used a webcam with rolling shutter, which streams to the USB port. The image data is buffered for transfer. For a still image, the application reads individual frames from a buffer area (Listing 3).
Listing 3
usbCamMover.py – Saving Frames
[...] for i in range(4): # Read buffer cam.grab() ret, frame = cam.read() # Take a picture cv2.imwrite(img_name, frame) # Save image [...]
The image is saved, the focus setting is updated, and the next image follows. An inner loop iterates through the focus range, whereas, in an outer loop, the program moves to the capture positions. Finally, it returns the camera to the starting point and asks how to proceed. The file references comprise the directory name, the project name, a prefix, the camera position, and the focus value, followed by the image format. This way, each image can be mapped uniquely.
You can run the program on the Raspberry Pi with HDMI and a mouse as a standalone setup, but it is better to use VNC on the host. You would be transferring the image directories to the host anyway with an FTP client so you can run an image processing program for stacking.
Conclusions
The first webcams transmitted images of a coffee machine at Cambridge University in 1991 and went online starting in 1993. The now world-famous coffee machine was auctioned off in 2001, repaired by the manufacturer, and on the web until 2015. Today, people prefer to stream urban situations, or participants in an online conference put themselves in the picture.
Now that webcams deliver a resolution of 8Mpx and many industrial applications work with USB cameras, you can give them a try in photography. Miniature and tabletop photography with continuous shooting are options; easy handling, program control, and a decent image quality make the venture seem promising. A Raspberry Pi 4 controlling the setup rounds off the tabletop scenario.
Infos
- Pi Camera Module 2: https://www.raspberrypi.org/products/camera-module-v2
- Pi Camera Module 2 NoIR: https://www.raspberrypi.org/products/pi-noir-camera-v2
- Pi Camera: https://picamera.readthedocs.io
- Raspberry Pi High Quality Camera: https://www.raspberrypi.org/products/raspberry-pi-high-quality-camera
- Microsoft LifeCam Cinema: https://www.microsoft.com/de-de/d/lifecam-cinema/94f910x3714n
- Logitech C920 HD Pro: https://www.logitech.com/de-de/products/webcams/c920-pro-hd-webcam.960-001055.html
- Logitech Brio: https://www.logitech.com/de-de/products/webcams/brio-4k-hdr-webcam.960-001106.html
- MacroFusion: https://sourceforge.net/projects/macrofusion/
- Code for this article: ftp://ftp.linux-magazine.com/pub/listings/linux-magazine.com/254
« Previous 1 2 3
Buy this article as PDF
(incl. VAT)