I have an Arducam IMX519 with 4 cameras and 1 hat for the raspberry pi. I’m trying to set a different manual focus distance for each of the 4 cameras, since using the libcamera-still image with autofocus takes too long (about 8 seconds). Is it possible to manually set the focus for each camera individually using the hat?
Hi @gunks,
- If you are taking synchronized quadcam photos, unfortunately, it looks like you cannot set the manual focus of each camera independently:
By default, the quad-camera kit works in synchronized 4-channel mode, and Raspberry Pi recognizes the whole kit as one camera Any manual focus or camera control adjustments (exposure/gain/white balance/etc.) will also be applied to 4 cameras at the same time.
- If you are taking individual photos from each of the four cameras (by i2c switching), you can set the manual focus (lens position) after switching between different cameras.
For example, if you do it in python, check out “Section 5.2.3. Setting the Lens Position Manually” in the Picamera2 manual.
You can also do it on the command line by passing --autofocus-mode manual --lens-position {your_desired_value} to libcamera-still. However, since the camera has to be initialized (which seems to take about two seconds?), I think that repeated invocations of libcamera-still will be much slower than the programmatically i2c swapping the camera and calling from python Picamera2 within a loop:
picam2.set_controls({"AfMode": controls.AfModeEnum.Manual, "LensPosition": lens_positions[i]})
where lens_positions is a list storing the four lens position values you want for your different cameras.