Hi, hoping someone can help with a strange camera issue. We’ve got 17 of these camera modules on Raspberry Pis and 14 of them work fine. But 2 of them show completely wrong colors, and a 3rd one won’t autofocus at all.
The color problem is really specific: it only happens when I use transform=Transform(hflip=1, vflip=1) in the code. If I set vflip=1 on its own, the image flips vertically and the colors are fine. With hflip=0 and vflip=0 the colors are also fine. The anomaly only shows up when hflip=1 and vflip=1 are both set. Our hardware spec requires the flip, so I can’t just leave hflip off.
Setup: Raspberry Pi accessed over SSH, running a Flask app. The browser opens the Pi at xxx.xxx.xxx.xxx:5000 and there’s a ‘trigger’ button to view/capture images. One of the bad cameras is connected now, and archive.zip is in /home/pi/.
I’ve already tried upgrading the firmware several times with no luck.
Thanks for the detailed report. Let’s figure out if it’s the module or the pipeline. I’ve sent you a small test script (test.py) via private message - it captures each camera with flip off and flip on. Run it and paste the output here.
Also, which firmware version are these modules on? And does the wrong color show up in the saved image, or only in the web preview?
test_cam1_flip_0 = Camera 1 without flip = ok
test_cam1_flip_1 = Camera 1 with flip = error
test_cam2_flip_0 = Camera 2 without flip = ok
test_cam2_flip_1 = Camera 2 with flip = error
test_cam3_flip_0 = Camera 3 without flip = ok
test_cam3_flip_1 = Camera 3 with flip = ok
test_cam4_flip_0 = Camera 4 without flip = ok
test_cam4_flip_1 = Camera 4 with flip = ok
So cameras 1 and 2 are the problem ones, 3 and 4 are fine. The app itself is a Flask script - app.py plus a template at /templates/sicavision.html that uses the same Transform(hflip=1, vflip=1) call. I’ve also attached the autofocus logs for the 3rd camera.
That’s very useful. So vflip=1 alone works correctly and flips the image vertically, but the moment hflip=1 is involved the colors go wrong - and only on cameras 1 and 2. Cameras 3 and 4 handle the same transform fine.
Let’s check the direct capture path. Run this with each problem camera attached:
libcamera-still -t 6000 -o 1A.jpg
and check the stills. Then run:
libcamera-still -t 10000
and after the preview window closes, run dmesg and send me the output. That will also tell us if the focus driver is throwing anything on the autofocus camera.
Also please share the environment/project/code setup you use to reproduce the color issue so I can try it here.
Okay, interesting result: when I capture with libcamera-still directly, the colors are totally normal. The color problem only appears inside my app with the hflip/vflip transform. I’ve sent the dmesg output and the capture via private message.
So the sensor itself looks fine - it’s something in my pipeline that triggers it, but only on those two cameras.
That matches what I’m seeing. I ran a simple picamera2 script here to verify the flip function, and also ran test.py 50 times per camera - all normal, no color problems on my end.
So the root cause isn’t the cameras in the normal capture path. The color error is triggered specifically by hflip=1 (vflip=1 alone is fine; anomalies only happen with hflip=1 + vflip=1).
Next step: let’s rule out firmware. I’ve sent you the correct firmware package via private message - please copy it to the Pi and try the update as soon as possible. If that doesn’t fix it, I’ll need a remote session to look at the live pipeline.
I’ve tried firmware upgrades several times before on my own, but I’ll try the package you sent. I’ve also set up remote access on the Pi in case you need to look at it - I’ve sent the connection details via private message. When could you connect?
Thanks. If the package doesn’t resolve it, I’ll connect remotely. Our working hours are 8:30am to 5:30pm Hong Kong time. The workflow will be: I connect to your PC via the remote tool, then SSH from there into the Raspberry Pi. Please have the firmware package copied onto the Pi (it’s /home/pi/archive.zip) and keep one of the problem cameras connected.
How about Tuesday, March 26? I’ll have the Raspberry Pi and remote access up at 7:30am GMT+1. I’ll send a message once everything is running. Goal is to get the firmware upgrade done as you suggested.
Tuesday works for me. I’ve sent the remote session details and a meeting link via private message so we can talk while I work. Keep the Pi powered on with the problem camera attached.
We finally managed to solve the problem together. The colors are now correct on cameras 1 and 2 even with hflip=1 + vflip=1. We’re confident using these cameras now, and we know how to fix it if it happens again.
Great to hear. Quick recap for anyone hitting this: the color problem was triggered by hflip=1 in the transform, but the underlying cause was the firmware - which is why direct libcamera-still captures looked fine. Updating to the correct firmware fixed cameras 1 and 2. The third camera’s autofocus is a hardware fault and can’t be fixed remotely, so that one needs physical service. The remote repair flow we used was: remote tool → PC → SSH → Raspberry Pi.