Dual camera color mismatch (cam1 reddish) and extracting lens position from --info-text

Hi, we’re using a custom dual camera module (cam0 and cam1) with libcamera on a Raspberry Pi. Both cameras are shooting under the same lighting with default settings, but the images from cam1 come out noticeably reddish compared to cam0. I need to understand why the color differs when the settings are the same, and how to adjust it so the two images basically match.

Also, our application needs fine adjustment of the lens position, so I first need to read and extract the current lens position value. I’ve seen focus and lens position shown when using --info-text, but I don’t know how to extract those values to use them in code. Is there a command or API to get the current lens position?

Thanks for the details. Before we dig into the color difference — did you use the exact same command to capture/store images from both cameras? Looking at your sample images, it looks like a different tuning file may have been used between cam0 and cam1; the reddish cast is usually related to lens shading.

Can you try forcing the same tuning file for both cameras and see if that helps?

libcamera-still -t 5000 --tuning-file /usr/share/libcamera/ipa/rpi/vc4/imx477_af.json -o test0.jpg --camera 0
libcamera-still -t 5000 --tuning-file /usr/share/libcamera/ipa/rpi/vc4/imx477_af.json -o test1.jpg --camera 1

As for your second point about reading/extracting the current lens position for fine-tuning — I’m putting together a demo for that and should have it for you within a day or two.

Thanks for the suggestion. I took the camera module out of the device and captured two fresh images with the same tuning file, but there’s still a clear color difference between cam0 and cam1 (the reddish cast). This level of mismatch is basically unusable for us.

I double-checked that both used /usr/share/libcamera/ipa/rpi/vc4/imx477_af.json — I’ve attached the JSON file I used.

Commands:

libcamera-still -t 5000 --tuning-file /usr/share/libcamera/ipa/rpi/vc4/imx477_af.json -o test0.jpg --camera 0
libcamera-still -t 5000 --tuning-file /usr/share/libcamera/ipa/rpi/vc4/imx477_af.json -o test1.jpg --camera 1

Do I need to fix some other parameters as well, or does this point to a problem with the module itself?

Thanks for retesting and confirming the tuning file is the same on both cameras. Can you tell me whether every unit in your batch shows this color issue, or just this particular set? That will tell us whether we’re dealing with a tuning issue or a per-module hardware variance.

Also, regarding the lens position fine-tuning question you raised earlier, I’ve prepared a demo. I’ve sent the demo package to you via private message — please check your messages and give it a try.

We have a batch of 25 dual-camera sets (50 cameras total). I sampled 3 units so far — 2 of them have a fairly obvious color difference, and 1 is only slightly off. The other 22 haven’t been tested yet. Given that, the probability of this issue is quite high and it could delay our product delivery.

I’ve attached photos from another camera with an obvious color difference. What’s the next step here? Could we do a remote debugging session where you guide us through the tuning in real time? We need a solution as soon as possible.

Thanks for testing the additional units. To summarize where we are:

  • Forcing the same tuning file (imx477_af.json) on both cameras does not remove the reddish cast.
  • The issue appears across multiple units with varying severity (2 obvious, 1 slight out of 3 tested).
  • That points toward per-module lens shading differences rather than a simple tuning-file mismatch, which is why a single shared tuning file isn’t enough.

The demo I sent via private message addresses the lens position reading/fine-tuning part of your requirement — please test that separately and let me know how it goes. For the color difference, we’ll need to look at the sample images from the additional units and likely work out a per-module tuning/calibration approach. If a live session would help, I can arrange a remote debugging session and send you the details privately.