Why do my Raspberry Pi camera images shift color near the edges, and can it be corrected?

Asked 5/26/2018

1 views

2 answers

0

I’m testing a Raspberry Pi camera module with various M12, C, and CS-mount lenses and consistently see color shifts and reduced saturation near the image borders, especially in yellows. I’ve reproduced it with another Pi camera and under stronger lighting. Disabling auto white balance improved the result, but edge color issues remain. Is this just vignetting, a sensor/lens-shading issue, or something inherent to the PiCam setup? Can it be corrected, or is cropping to the center the practical solution?

Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0

Photography Stack Exchange contributor

8y ago

2 Answers

4

Radial Falloff

What you are seeing is known as radial falloff. The coloration is a result of the green-magenta compensation common to most color correction schemes in RGGB (bayer) sensors. Basically, the amount of light lost as you move to the edges of the frame is normal and more green is lost because there is more green sensitivity.

Flat Field Correction

You are on the right path to assume that an internal correction method should exist. Sensor designers will refer to this as "flat field Correction" and a flat field matrix, function, or look up table is part of the firmware of nearly every digital sensor in existence. It is not uncommon for technical cameras to offer the ability to calibrate or even directly influence the FFC. The extended user guide may describe how to access your camera's FFC. A quick google search uncovered this project for the PiCam.

If you cannot manage to get your sensor to correct its own radial falloff, it can be done later in post processing. Some dynamic range can be lost this way, especially in compressed formats (JPEG/WMV/MP4) You can calculate your lost dynamic range using the SNR equation. Nonuniformity in illumination can be corrected using a plugin to photoshop or a prescribed technique Programatically this problem has been solved in MATLAB and the like.

NOTE: bear in mind that you are seeing a chromatic shift. This means that your post-processing corrections or in-camera FFC must be channel-specific. Many "vignette" corrections are luminance based and will not help you unless you decompose the image into two (LAB) or three (RGB) grayscale images first.

DIY FFC

The way an FFC maps are built in camera labs is by exposing the image, at neutral exposure, to an integrating sphere. A cheaper alternative is to place a piece of optical diffuser (I prefer opal glass) between the sensor and a Light Box You may be able to fit a circular diffuser into your lens mount. Try to keep as much stray (non diffuse) light out as possible. IME, this setup will be 1% accurate if you spend $50 and 0.1% accurate if you spend $200, assuming you take the time to carefully tweak the setup. If $50 is still too expensive you can achieve some level of field correction using several layers of parchment or wax paper and an area light source such as a fluorescent fixture or a halogen worklight.

To create your DIY reference image, just capture a neutral image (preferably) in raw format. In post processing, subtract or overlay the neutral image from each captured raw. This can also be done with processed images such as tifs and jpegs but only if the exact same settings were used in post (no auto processing.) If you intend to capture HDR with this camera, make a dark and a light reference image to compensate the dark and light HDR shots. An added bonus of this technique is the process can also be used to map bad pixels as well.

Originally by user71671. Source · Licensed CC BY-SA 4.0

user71671

8y ago

0

AI Answer

Generated from our catalog & community — verify before relying on it.

This is not just simple vignetting. What you’re seeing is consistent with radial falloff plus lens/sensor shading effects, where illumination drops toward the edges and the camera’s color correction can produce green/magenta or desaturated edge shifts.

On Raspberry Pi cameras, lens shading correction (a flat-field / RGGB correction table) is a key factor. Auto white balance can make the problem look worse, so disabling AWB was a good test. The remaining edge shift suggests the optical setup and shading correction still don’t match well.

In general, this can sometimes be improved by:

  • using or tuning lens shading / flat-field correction
  • ensuring the correction table matches the sensor+lens setup
  • avoiding lenses that poorly cover the sensor or have strong edge falloff

If the correction cannot be tuned properly, then edge blur, distortion, and color shift may be unavoidable with some PiCam/lens combinations, and cropping to the center may be the most practical fix.

UniqueBot

AI

8y ago

Your Answer