Hi everyone. We’re running a set of Arducam OV5647 motorized focus cameras and we’re seeing noticeable image quality differences between cameras, even though the lighting is stable and every camera is using exactly the same settings. It’s roughly 7 cameras, and the colour reproduction doesn’t match between them. We had a focus-related issue before that got sorted, but this colour difference between units feels like a new problem. Has anyone else run into this?
Thanks for the report. I can see how the focusing effects could look a bit different between cameras, and I understand it’s harder to accept that colour would also vary. The colour variation you’re describing is probably not a direct result of the focus/factory position differences. Each motor can have a small variation in its factory-set position, which mainly affects the focusing effect rather than colour. Colour consistency on Arducam products is tightly controlled during manufacturing, so it’s unlikely the position differences are causing the colour shift. Could you share a few sample pictures from the affected cameras so we can look into it further?
Here’s more detail and some test data. We tested five OV5647 motorized focus cameras, all isolated from external light sources, so the only variable changing is the camera itself.
Software: picamera2 0.3.12, libcamera 1.2.1-1.
We used a fixed script (Problem_1.py). With two cameras under the same fixed code there’s a clear colour discrepancy, and it’s consistent across all five cameras — the photos come out with different colour temperatures.
With a single camera (no changes), we ran 10 tests capturing 20 photos each. Colour similarity within each test is generally high, but the colour level differs between the first and second test in each set. One weird thing: the Focus_FOM parameter starts around 3000 and sometimes drops to 2000 or lower in later tests, even though we never change focus between tests.
We made a mitigation script (Solve_Problem_1.py) that applies slight gain adjustments and gets both cameras to produce similar colours. That mostly works around Problem 1, but we’d like to fix the root cause.
The Python code is in a GitHub repo, and I’ve attached the photos (numbered) in a zip. I also searched GitHub and forums and put the relevant links in Problem.txt, but none of them resolved it. Also, could someone point me to how to read these images properly with Python?
Just checking in — any update on this?
Sorry for the wait. One thing to try: discard the first two frames before you actually take the picture. During those initial frames the camera may be automatically adjusting certain settings that are difficult to control, which can cause inconsistency between captures. Skipping the first couple of frames gives you better control over the settings and should get you more accurate, repeatable images.
Thanks, we’re already discarding the initial frames. The bigger question is: what fixed settings should we use to get the same image from different cameras? We need a recommended baseline for cross-camera consistency.
I’d suggest running a practical test to figure out the optimal number of frames to discard for your specific setup. The default strategy in libcamera may not be precise enough for what you’re trying to achieve. For the OV5647, libcamera’s default is to discard the first two frames — you can see it in the cam_helper here: libcamera/src/ipa/rpi/cam_helper/cam_helper_ov5647.cpp at 5ff5efbdc35dc61873b950326ca6798c44a37686 · raspberrypi/libcamera · GitHub — but depending on your requirements you may need to discard more frames than that.
Still seeing the issue. Even with automatic white balance off and fixed gains, we get different colour temperatures in multiple captures. It’s camera-to-camera variation. We’re discarding the initial frames already (without discarding it’s worse). I suspect we’re still missing some fixed setting — ISO, exposure, gain, something. The lighting source is a backlight and it’s the same across captures. Can you give us the standard fixed settings (ISO, exposure, gain) for consistent images across cameras?
With the white balance gain fixed, the camera should ideally produce the same colour temperature. Any small change in the scene can affect what the automatic algorithm calculates, but if the gain is truly fixed that shouldn’t be the main issue. The camera may need a few frames for parameters to stabilise, which is why discarding the first frames matters.
One more thing to check: the OV5647 sensor has its own auto white balance feature. It’s off by default, but it’s worth confirming. Run:
v4l2-ctl -l -d /dev/v4l-subdev1
and check that the sensor-level auto white balance is off. If it’s enabled, that could explain the colour temperature changing even with fixed gains.
The colour temperature still changes randomly, even with the same fixed white balance and same lighting. AWB is off. We’re capturing around 10 images and dropping the first 5. There’s still variance between cameras. Could you give us a step-by-step capture process to replicate? I feel like we’re missing a step somewhere.
Any update?
I’ve put together a custom tuning file (ov5647.json) and a solved version of the program for you. I’ve sent both through private message — please check your messages. Once you have them, place ov5647.json at /home/pi, then run Solve_Problem_1.py with the tuning file set. The custom tuning file standardises the settings and should address the camera-to-camera colour consistency issue. Give that a try and let me know how the captures look.