RayXie29 / Shading_Correction

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

#Lens shading/vignetting correction algorithm
This repo is the implementation of Patent US20070211154 which is the lens vignetting correction algorithm.
Vigetting is a pheonmenon that the brightness is decreasing from image center to corner. This pheonmenon might due to design of camera lens or camera setting.
This patent is using a radially symmetric polynomial function to correct the issue. This might because the vignetting effect is happened radially symmertic from center to corner.


First we need to use a raw image to calculate the paramteres of correction function. This raw image is from the camera system you want to correct and it doesnt have any ISP pipeline processing yet. If your camera is using color sensor, then the raw image should be a bayer image. Normally this raw image should take an flat uniform light source. We can from the image of your camera taking flat uniform light source to know the vignetting situation. And use this situation to calibrate the function parameters.

Here is my raw image, resolution : 640x480 , bayer pattern : BGGR
alt text
We use this raw image to calculate the function parameters -> "ShadingParameters.csv"
Then we use the correction function to correct the image, here is the result
alt text
Then we do some color interpolation and correction on them to make the images normal.
Here is the original image after color interpolation and correction
alt text
And here is the image after shading correction and color interpolation/correction
alt text


I also used the corrected image to subtract the original image to see the correction effect. From this difference we can see the image region close to center has very few change. But the corner part, which is the serious vignetting region has very effective change.

alt text
reference:
https://patents.google.com/patent/US20070211154

About


Languages

Language:C++ 96.4%Language:C 3.6%