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

Lens Shading Calibration

The topic of this article is to tell users how to fix the lens shading of the Arducam lens.
Because there is no official hardware ISP interface technical support, the Arducam technical team recompiled the raspistill tool and did its best to solve the lens shading problem.
Now, Arducam provides two solutions to this problem. The first solution is to use the raspistill tool that Ardcuam recompiled directly. The other solution is that we will tell user how to add lens shading table in the raspistill.c code and the user can recompile it by themselves.

For the first solution, Arducam has provided tools for M12 series lens and CS lens. Get it here

1

The user just needs to copy it to the PI directory and execute it just like the official raspistill command. For example: If I am using Arducam M12 90 ° no distortion lens. I just need to copy the raspistill_M12_90_lens to my /home/pi path then cd /home/pi and run ./ raspistill_M12_90_lens –t 0 to preview.
The following is a comparison of Arducam M12 lenses before and after lens shading correction. The left is the the image before lens shading correction and the right is the image after lens shading correction

  • 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

The other solution: user should use the ls_table Arducam provided.Get it here

2
  1. Now recompile the raspistill source code to correct the lens vignetting using the generated lens gain table data (ubuntu16 cross compilation)
    (1) Download userland source code
    git clone https://github.com/6by9/userland.git
    (2) Install cmake
    sudo apt-get install cmake

Modify the raspistill.c file. Rename the ls_table_M12xxx to ls_table.h and copy the file in the raspicam path

3

Open the raspistill.c file add some changes code.

4
5
6

Then recompile:

7

Then you will get the new raspistill tool which is in the build/bin/ path

8

Was this article helpful to you? Yes No