Yes this is a known issue. The autofocus motor is basically an electromagnet pushing against a spring - we can control the current but have no feedback of its true position. When pointed downwards, the weight of the lens makes the focus range closer.
And yes, there is a workaround. You'll need to take a copy of the camera tuning file which (for the standard "daylight" v3 camera) is one of:The "pisp" one is used on Raspberry Pi 5 and the "vc4" one on earlier models. For other camera variants, you'll need to copy the "im708_wide.json", "imx708_noir.json" or "imx708_wide_noir.json" file instead. For some versions of libcamera it might be in "/usr/local" instead.
Now edit your copy and search for the string "map" about 90% of the way down the file. It should be followed by a list of 4 numbers. The second number is the lens driver setting for infinity; try reducing it to (say) 380. The last number is the lens driver setting that's supposed to correspond to a distance of 67mm; try reducing it to 880. You might need to do some fine-tuning.
To use the modified file, set this environment variable:or prefix that setting onto the command that controls the camera.
And yes, there is a workaround. You'll need to take a copy of the camera tuning file which (for the standard "daylight" v3 camera) is one of:
Code:
/usr/share/libcamera/ipa/rpi/pisp/imx708.json/usr/share/libcamera/ipa/rpi/vc4/imx708.json
Now edit your copy and search for the string "map" about 90% of the way down the file. It should be followed by a list of 4 numbers. The second number is the lens driver setting for infinity; try reducing it to (say) 380. The last number is the lens driver setting that's supposed to correspond to a distance of 67mm; try reducing it to 880. You might need to do some fine-tuning.
To use the modified file, set this environment variable:
Code:
export LIBCAMERA_RPI_TUNING_FILE=filename.json
Statistics: Posted by njh — Fri Jun 21, 2024 9:42 am