Redness around edges of Arducam 8MP PTZ camera preview on Raspberry Pi 4B

Hi everyone. I have an Arducam 8MP IMX219DS PTZ camera (model B01678MP) on a Raspberry Pi 4B, and the preview image has a red tint around the edges. It looks like a lens shading issue. I saw an imx219_45d.json lens shading file mentioned somewhere — could someone tell me which folder it should go in? Also, the image turns red again whenever I run:

cd PTZ-Camera-Controller
python3 FocuserExample.py

Any help would be appreciated.

Welcome to the forum. Yes, that red color around the edges is a lens shading issue. The tuning JSON file has to be placed in the libcamera IPA directory, specifically:

/usr/share/libcamera/ipa/raspberrypi

I’ve also sent you the lens shading file through a private message, so please check your messages if you don’t already have it. After placing it there, you can follow the calibration guide here:

https://docs.arducam.com/Raspberry-Pi-Camera/Native-camera/Lens-Shading/#how-should-i-tune-the-configuration-file-to-match-my-lens

If the JSON I sent doesn’t suit your particular lens, you can look through the other options here:

One more thing to keep in mind: this camera is not supported on Raspberry Pi OS Buster.

Thanks for the reply. I tried placing imx219_45d.json in /usr/share/libcamera/ipa/raspberrypi, but the edges still turn red when I run FocuserExample.py. The camera also works intermittently and feels unstable overall. I’m wondering if I need an ISP file to tune the camera parameters.

Also, can this camera run with the Python picamera library on Raspberry Pi OS Buster? I saw the note that it can’t be used on Buster, just wanted to confirm.

For reference, my setup is a Pi 4B with the B01678MP 8MP PTZ camera. The redness comes back every time I run:

cd PTZ-Camera-Controller
python3 FocuserExample.py

The key detail here is that the red color correction depends on which software stack is being used. With libcamera you can get some degree of red color correction, but FocuserExample.py uses the OpenCV library, and OpenCV does not apply lens shading correction. So even if the correct JSON file is in place, that particular script will still show the red edges — that’s not something you can correct inside FocuserExample.py itself.

For the red color correction, stick with libcamera-based capture rather than the OpenCV example. And yes, to confirm: this camera is not supported on Buster.

That makes sense. I’ve switched to picamera2 and I’m loading the tuning file using the load_tuning_file function. Right now I’m using the imx219_200 json file, whereas before I was using imx219_45d.json. The redness is still around the edges though. Which JSON file from the lens shading list would be the best match for the B01678MP lens?

The field of view (FOV) of these modules can vary from unit to unit, so there isn’t one single JSON file that is definitively the correct choice for every B01678MP camera. The most reliable approach is to test a few different JSON files through load_tuning_file and pick the one that gives the cleanest result for your specific unit and application. It’s a bit of trial and error because of the module-to-module FOV variation.