Lens Shading Calibration
Before and after the calibration
What is the lens shading effect we are talking about?
Sometimes when you replace the original lens of the Raspberry Pi V2 or HQ camera with an Arducam Lens, you will encounter a color issue where the outer side of the picture looks pink or magenta. That is a lens shading artifact, which is expected but can be solved.
It is expected because the default compensation is only valid for the stock lens of the Pi cameras, while different lens should have been compensated differently for their optical results. It can be solved because the file to alter the compensation – the lens shading table – can be overridden to match your own lens.
How should I tune the configuration file to match my lens?
Well, you don’t have to tune the compensation yourself because Arducam has already done the work for you. You just need to double check which Arducam lens you have on hand and know what the corresponding files you will be using.
Here is the matching relationship between the FoV, SKU, and Part number of the most used Arducam M12 lenses, and you will be referring to the FoV degree numbers in the first column for the target file.
HFoV on 1/4″ | Part Number | SKU |
---|---|---|
10 | M2016ZH01 | LN001 |
20 | M2508ZH02 | LN002 |
40 | M2506ZH04 | LN003 |
45 | M2504ZH05S | LN011 |
55 | M25360H06 | LN004 |
56 | LS-27227 | U1462 |
60 | M25360H06S | LN012 |
65 | M40320M06S | LN015 |
70 | M27280M07S | LN013 |
80 | M27210H08 | LN005 |
90 | M40210M09S | LN014 |
100 | M40180H10 | LN006 |
120 | M25170H12 | LN007 |
140 | M25156H14 | LN008 |
160 | M30171H16 | LN009 |
200 | M32076M20 | LN010 |
Arducam lens matching relationship
How to use the Arducam presets for lens shading calibration?
We currently develop libcamera tools to calibrate the lens shading for the V2/HQ cameras. Please refer to the following content to calibrate the lens shading for IMX219 and IMX477 cameras in the new system of Raspberry Pi.
Use libcmaera calibration tool
1. Download and Save the JSON file locally on your Raspberry Pi
Please refer to the following link:
Json file for IMX219 and IMX477 Camera Lens Shading
2. Run the command
libcamera-still -t 0 --tuning-file xxx.json
3. Then you can get the great lens calibration
The expected results of the Calibration
IMX219
- M12 FOV:20°
- M12 FOV:40°
- M12 FOV:45°
- M12 FOV:55°
- M12 FOV:60°
- M12 FOV:65°
- M12 FOV:70°
- M12 FOV:80°
- M12 FOV:100°
- M12 FOV:120°
- M12 FOV:140°
- M12 FOV:160°
- M12 FOV:200°