Hi, we’re running the Arducam IMX219 8MP Autofocus USB Camera Module (3280×2464 @ 30fps) on a Raspberry Pi 4B. The pictures coming from the cameras are out of focus / too blurry. We don’t need to focus on any specific point, we just need clear images. We’ve tried setting the focus controls, but some cameras still produce blurry pictures. What has mostly worked is: enable autofocus, take a few pictures, then disable autofocus. After that most cameras are OK, but one camera is still blurry and another camera is not detected at all.
Let’s separate the two problem units. For the camera that still won’t focus, can it autofocus normally when you test it in Amacap.exe on a PC? For the camera that isn’t detected, does the Raspberry Pi list the device at all when it’s connected? You can check /dev/video* and the controls with:
v4l2-ctl -d /dev/video0 --set-ctrl=focus_automatic_continuous=0
v4l2-ctl -d /dev/video0 --set-ctrl=focus_absolute=0
v4l2-ctl -d /dev/video0 --set-ctrl=focus_automatic_continuous=1
v4l2-ctl -d /dev/video0 --set-ctrl=focus_automatic_continuous=0
Update on the focus camera: it’s mounted around 7 ft high and tilted downward. The autofocus-toggle workaround that fixed the others does not fix this one. With autofocus enabled it tries to focus but the image stays blurry. Setting focus_absolute=0 also doesn’t give a clear image on this camera, so I suspect a focus-specific hardware issue. Sample pictures: test_102 is at height with tilt, test_100 is lower on the same pole without tilt. I also moved the camera down to about 5 ft with zero tilt from the pole, and that got a clear image, but still not as clear as the other lower-mounted cameras. For the undetected camera: it doesn’t show up in devices, but I tested its USB cable with another camera and the cable works fine.
Thanks, that helps. The fact that lowering it and removing tilt improved things matters, but it still not matching the other units is suspicious. Could you share videos showing both failures — one where the camera isn’t detected and one where the focus won’t work? You can send them via private message if that’s easier.
Just to be clear on the focus workaround: disabling autofocus and setting focus_absolute=0 does not give clear images on this unit. For some cameras focus_absolute=0 works, for others nothing works. The sequence that helps most units is: enable autofocus, take a picture, then disable autofocus. I’ve sent a video explaining the setup and captured images via private message (IMG_7014.MOV).
Thanks, I’ll check the video. While I look at it, can you try the exact same camera, position, and settings on a different machine? That would tell us whether this is specific to the Raspberry Pi environment or the camera itself.
Good suggestion. I tested the same camera in the same position with the same settings on a laptop, and it produces the desired images. On the Raspberry Pi 4B it still fails. Any pointers on what could be wrong with the Pi?
That’s a strong clue — if the same camera and settings work on the laptop but not the Pi, it points more to the platform/software side than a simple camera fault. What software are you using on the Raspberry Pi to preview the camera?
I’m doing everything from the terminal. The Pi is running Raspberry Pi OS Bullseye. Commands I use:
sudo v4l2-ctl -d /dev/video0 --set-ctrl=focus_automatic_continuous=0
sudo v4l2-ctl -d /dev/video0 --set-ctrl=focus_absolute=0
fswebcam -d /dev/video0 -r 1920x1080p out.jpg
Thanks. Since you’re on Bullseye and using v4l2-ctl + fswebcam, try previewing the feed in VLC on the Pi and see if the focus behaves the same as the captured stills. That will help separate a capture-stack issue from the camera itself. Summary of where we are: focus behavior is inconsistent across units; the same camera/settings work on a laptop but not the Pi (Bullseye), and the undetected unit is still a separate detection problem. Try VLC and let us know how it looks.