Cameras for Raspberry Pi

  1. Home
  2. Docs
  3. Cameras for Raspberry Pi
  4. Native Raspberry Pi Cameras
  5. Lens Shading Calibration

Lens Shading Calibration

20
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 NumberSKU
10M2016ZH01LN001
20M2508ZH02LN002
40M2506ZH04LN003
45M2504ZH05SLN011
55M25360H06LN004
56LS-27227U1462
60M25360H06SLN012
65M40320M06SLN015
70M27280M07SLN013
80M27210H08LN005
90M40210M09SLN014
100M40180H10LN006
120M25170H12 LN007
140M25156H14LN008
160M30171H16LN009
200M32076M20LN010
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 below link: Json file of IMX219 and IMX477

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:10°
10
  • M12 FOV:20°
20
  • M12 FOV:40°
40
  • M12 FOV:45°
45
  • M12 FOV:55°
55
  • M12 FOV:60°
60
  • M12 FOV:65°
65
  • M12 FOV:70°
70
  • M12 FOV:80°
80
  • M12 FOV:100°
100
  • M12 FOV:120°
120
  • M12 FOV:140°
140
  • M12 FOV:160°
160
  • M12 FOV:200°
200

Was this article helpful to you? Yes No