Continuous shooting for detailed photography

Continuous Shooting

Programs like Guvcview are suitable as a test tool but cannot control specific processes, which means you need your own software with a graphical user interface (GUI). The programming language of choice is the object-oriented Python 3 with its numerous practical libraries for designing graphical interfaces, such as the guizero library, which is easy to use. The stepper motor is controlled by the Python RPi.GPIO module, whereas OpenCV takes care of capturing and saving the images.

The software's self-made GUI is located in the file and comprises two panels: one for exposure settings and one for camera settings, including zoom and focus (Figure 3). I will not go into the programming in detail here; the software, which is still a bit of a hack, can be found on the Linux Magazine FTP site [9].

Figure 3: The graphical interface of the DIY camera control.

Camera Control

The settings in the Camera Controls dialog influences the image geometry. The field of view (FoV) is limited by the Zoom factor. The number of shots required depends on the focus range and its step size. The horizontal camera position is controlled by the distance of the camera to the object. A list of factors for the travel distance is embedded in the program.

The accepted Zoom factor for the Brio is between 100 and 500 with a given step size of 1. At 4K resolution (i.e., 3840x2160px), a horizontal field of view between 78 and 43 degrees can be achieved. However, zoom factors larger than 200 no longer have an effect at ultra-high definition (UHD) resolution.

The UHD resolution of the Logitech Brio is only offered with the MJPEG pixel format. For this, the code in Listing 2 adapts the initialization with the variables width and height to suit the connected camera.

Listing 2 – Initialization

cam0.set(6, cv2.VideoWriter_fourcc('M', 'J', 'P', 'G')) # setting MJPG codec
#width    =  1920 # HD
#height   =  1080 # HD
width     =  3840 # UHD (Brio, USB3)
height    =  2160 # UHD (Brio, USB3)

The zoom factor in FHD resolution (1920x1080px) is different. With factors up to 200, the FoV changes to the same extent as with the higher resolution, but if you go beyond that, it can narrow the angle by up to 18 degrees (zoom factor 500). Figure 4 compares the image crops at 4K resolution.

Figure 4: Zoom factors 100 (white), 150 (green), and 200 (yellow) for Logitech Brio 4K resolution.

At full FoV, a high lens distortion is noticeable in the peripheral area, which might need to be corrected by optical inspection or mathematically with the camera's calibration data. Even a low zoom factor reduces the extreme distortion.

The HD, FHD, and UHD camera resolutions each result in an image in 16:9 format. The relevant image area does not always fill this format, so you often work with image crops in postprocessing. Therefore, it is necessary to weigh between object distance and zoom factor the extent to which optimum resolution can be achieved.

If you can get close enough to the object, it's best to opt for 4K resolution. If you need to get farther away, consider the crop factor. If necessary, switch to 2K resolution with a smaller FoV.

For example, in Figure 5, only the cyclist's face is of interest. With 4K resolution and zoom factor 200, you capture too much unneeded information. At an identical shooting distance with 2K resolution, a smaller section can be captured with a zoom factor of 500, resulting in a higher resolution for the image area of interest. In general, however, the USB camera is only significant for still images with the 8Mpx sensors.

Figure 5: A comparison between resolution and maximum zoom factor. In some situations, it is more convenient to work with lower camera resolutions.

Focus Range

Another aspect of the rational image acquisition technique is the focus range. The parameter values are between 0 and 250 with a default step size of 1. Too many exposures would overload the stacking software, so it is best to limit the range and thus sensibly minimize the number of shots.

An example about 2cm (close-up range) from the object and focusing with a value of 220 becomes interesting, whereas a parameter of around 110 is useful up to about 8cm. With a step size of 5, 22 exposures were created for the builders in Figure 6 in the close-up range. The figure shows the results after stacking.

Figure 6: The focus in this shot was between 3cm and 8cm.

If you increase the distance to the subject to about 10-40cm, focus settings from 40 to 100 on the right side are recommended. In Figure 7, the first red doll was focused with a value of 79 and at a distance of about 17cm. A range of 40cm therefore translates to about 200 focus units; given a step size of 5, this corresponds to 40 exposures. You therefore have a defined design framework that you can validate in a preview.

Figure 7: Focus planes in the close-up range. To get all the figures in focus, you must process several shots together.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • DIY Lenticular Camera

    You can take lenticular images with a homemade camera to re-create the "wiggle" pictures of your childhood.

  • Webcam Rescue

    If your new webcam doesn't work with the default software on your Linux system, try your luck with Guvcview or QtCAM.

  • Digital_Photo_Intro.pdf

    The Linux environment includes some powerful tools for editing, managing, and scanning digital images.

  • Surveillance with NAS

    Take advantage of the low watt per operation compute power offered by modern NAS to monitor your cameras.

  • Workspace: Photo Helpers

    Capture, transfer, process, and manage photos using the Entangle, Rapid Photo Downloader, and GTKRawGallery applications.

comments powered by Disqus
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.

Learn More