Manual awb compensation for Arducam IMX298 MIPI 16MP


I am looking for wrapper for setting manualy awb compensation through python. I see that I can do this in cpp and it works well in examples that Arducam team provided, but because I have everything in python i have to stick to that. I have tried to do this on my own but I failed miserably.

I need this because I need to have the same camera parameters everytime I will init it…

Could you help me with that or at least point in which direction I should go?



I have help you add manual_set_awb_compensation python version Please download our new lb to try

You can try to use it as the follow steps:


I have downloaded and installed library as well as rest of the files.

When I ran to get a photo i got Segmentation Fault and since then I can not get “right images” in full resolution…

In lower resolution image looks alright, but in full it looks like image below. I have deleted MIPI_Camera and cloned it again but it did not help. Could you help me with that?





I have added an answer a few minutes ago but I do not see it, so I will post answer once again.

I downloaded new lb as well as whole MIPI_Camera and added camera.manual_set_awb_compensation(100, 100).

When I run I got segmentation fault and since then I can not get “right images” in full res. I deleted whole MIPI_Camera folder and basically clone folder once again buy it did not help.

Could you help me with that?


I have tested again just now. and I am ensure I have add this function for python .

I have attached two pictures for you. After download the MIPI_Camera, have you run make install to install the lib?

Let me know if you need more help.



I have followed every step in so yes. I did everything including installing .so file.

Right now my concern is that I can not get an image in full resolution without green and pink stripes. I will try to test it on different RPI and let you know how it looks like.

I got a second so I have connected camera to RPi3.

I can take an image in full res and it does not have easily visible stripes but i can see on image there are some artifacts like black horizontal line.

Also images I am having are green. AWB does not work at all now.

When I am executing I am having error:

mmal: Failed to set black level - try updating firmware

Is it possible that I have damaged sensor when executing script with manual gains? It was working when I was using c++ so I have no idea what happened here.


I have reinstalled Raspbians on my both RPis. On both I have installed Raspbian GNU/Linux 10 (buster) and followed this readme.

I set GPU memory to 250.

  • Rpi 4 4GB
On this model I could not get "good" image in full res. (4656 × 3496). Images are full of random noise with pink and green stripes. There is no difference between using c++ or python examples. I was turning awb on, off ect. No change there.

On lower resolutions everything works fine. Unfortunately I was really counting on full res on RPi4. I was hoping to get 4x 16MP cameras and connect them through ArduCAM multiplexer to RPi. I do not care about stereo, but I need 16MP+

  • Rpi3 b+
On this model camera seems to work fine. I can get full res images, manual white balance works as well as focus and everything else. However very rarely I got images with random pink stripes but it was only 1 or 2 and I did 150+ still images.


I have checked both RPis with different cameras. I used 5MP, 8MP and everything works fine so I think there is nothing wrong with RPis.

Could you please take a look on that? I am afraid this kind of problem is way above my skills. It looks a bit like there might be just to much data for RPi to read from sensor.


Because the speed of the sensor is too fast, the signal will interfere. I will try to reduce the clock speed of the sensor.

About the awb, after you have enabled awb, you should add some delay to wait the awb take effect.

Let me know if you need more help.



I have about 0.2 delay added.

Anyway, your solution works. I have tested it and had no problems at all. Worked on RPi 3 B+ as well as RPi 4 4GB.

Thanks !


You are welcome.

Great to hear that. About the delay, I advise you add 1 second to wait the awb take effects.