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 usbCamMover.py
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].

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
usbCamMover.py – 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) cam0.set(3,width) cam0.set(4,height [...]
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.

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.

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.

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.

« Previous 1 2 3 Next »
Buy this article as PDF
(incl. VAT)