I'm trying to build a camera based on rpicam for my company, but it seems I won't manage to do it without some advices.

I got some results using a CS board mount : CS board mount

A CS/C adapter when needed : CS/C adapter

And a dozen of different lens : M12, C, CS and even a macro one.

But whatever lens and parameter I choose, I always face the same problem, my photos lacks color near the borders (see how the yellow react).

enter image description here

Is this a form of vignetting ? Is there any hope I can improve the image, or should I just use the center of the sensor ?

Thank you !

Edit : I tried with another PiCam, and with more lights, got the same results.

Edit 2 : thanks to flolilolilo, i found out that the autowhite balance was enabled, and was seriously messing the image. I now have better results, but it seems the optical or sensor default is still present. Witout AWB

Here is a capture of the raw sensor, without lens. Sensor image witout lens

To mattdm : here is a shot of a uniform green paper sheet (the true color looks like the one at the center). enter image description here

And another shot of a white paper : white papaer photo

  • 1
    Maybe, the sensor is more sensitive towards the optical axis/middle of the frame. Or perhaps its software decides to do that. It does not look like any vignetting I have ever encountered. However: Have you tried to add some light to the scene? E.g. does this also happen in bright sunlight?
    – flolilo
    May 26 '18 at 10:10
  • 2
    Weird...Okay, I just thought of another way to find out what might be causing the issue: Does this issue also occur when not using a lens at all? I know that the result will be a giant blur, but in a scenario like the above picture, I would think that one should see whether the middle of the frame is more saturated than the rest or not.
    – flolilo
    May 26 '18 at 13:31
  • 1
    Thank you flolilolilo, one part of my problem was software tuning :) I added more photos for you both May 26 '18 at 16:48
  • 1
    Looks like a sensor- or software-related problem, then. I'm not sure what we can do to help you. perhaps it would be best to ask this over at raspberrypi.stackexchange.com ?
    – flolilo
    May 26 '18 at 18:37
  • 1
    Have you considered covering the edges of your lens in green Jello? May 30 '18 at 12:57

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.


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.


It seems I found the cause of this problem, or at least a solution for it.

The PICam sensor comes with a lens shading correction table, in form of an RGGB array, that may cause, or solve this color shifting. This setting isn't accessible in the official library, you must install this commit in order to access it : https://github.com/waveform80/picamera/pull/470

I played a bit with this table, and I didn't manage to get a good color correction. Still working on it !

Edit : I'm still quite unlucky with this optical configuration. Blur, distortion, and color-shifting near the image borders seems to be unavoidable. Picamera V1 is supposed to be better ...

  • Have you tried using a lens with a larger imaging circle to determine if reduced light falloff can improve the image?
    – xiota
    Jan 28 '19 at 19:48
  • Some progress : blur can be adressed with an openGL sharpening shader, distortion with openCV camera calibration process, color-shifting is still investigated ! May 26 '19 at 22:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.