Making some tests,
rpicam-vid --autofocus-mode continuous --timeout 0 --width 1000 --height 750 -o -| nc 192.168.1.33 5000
works good in all distance ranges
rpicam-vid --autofocus-mode manual --lens-position X --autofocus-range normal --timeout 0 --width 1000 --height 750 -o -| nc 192.168.1.33 5000
It works well if X>1 (or something), close distances. But if X<1, larger distances, focus is bad in the entire image, there’s no focus in any part of the image, close or far.
It is like autofocus-range is set as macro by default. I set --autofocus-range normal but nothing changes.
Same happens with rpicam-still
Another issue: Still images are good in autofocus auto mode from rpicam-still but they are out of focus from python script using libcamera2.
picam2.set_controls({"AfMetering": controls.AfMeteringEnum.Auto})
picam2.set_controls({"AfMode": controls.AfModeEnum.Auto})
And the image is stretched wide despite
camera_config = picam2.create_still_configuration({"size":(4656,3496)})
Streaming locally I don’t see the full picture, it is a zoomed in image which is useless to adjust camera position
rpicam-vid --autofocus-mode auto --width 640 --height 480 -o - | nc 192.168.1.33 5000