Create lens calibration data for lensfun

(George) #21

Hello, I would like to create calibration data for a zoom lens. The maximum and minimum aperture varies across the zoom range (focal distances as labeled on the lens):
70 mm: f/4 - f/32
100 mm: f/4.5 - f/36
135 mm: f/5 - f/40
200 mm: f/5.6 - f/45
300 mm: f/5.6 - f/45

Should I use the same range of apertures for each of the focal distances (f/5.6, f/8, f/11, f/16, f/32) or different ranges per focal distance, based on the specific minimum and maximum values (like for 70 mm: f/4, f/5.6, f/8, f/11, f/32)?


(Roman Lebedev) #22

There is no such requirement/limitation.

Just pretend that each focal length is a different prime lens, and profile it separately.



Usually i perform full wide, then common f-stops (es. if the lens starts from 2.4, then 2.8, 4, 5.6, 8, 11, 16, 22, if the lens starts from 1.8, 1.8, 2, 2.8, 4, 5.6, 8, 11, 16, 22, in you sample, es. at 100 mm i would do 4.5, 5.6, 8 and so on, at 135mm 5, 5.6, 8 and so on).

I use more values than stricly needed, since it’s more time consuming to make the setup than to take pictures, so i don’t waste much time calibrating all f-stops.


(Robert Stephan) #24

I do not have results yet, but the first preparations are in progress. Because I’m a lazy person that should be automated. For the aperture row, I made a small bash script. The aperture values offered by the respective lens are detected and from this a series of apertures is created which then runs on its own. Tested with the Canon Eos 5DS R and the EF 180mm macro.
Only for the vignette I have to come up with something else. The EF 11-24 f4 has a fixed lens hood, also tulip-shaped. That will not work with a simply lifted frosted glass. In case somebody need it I attached the script.
It works under Debian Buster.

# Blendenreihe, Kamera auf AV und Fokus MF
# shoot 6 Lv func. Leise LV-Aufnahme Modus 1
# getestet mit EOS 5DS R und Makro EF 180mm 1:3.5 L
/usr/bin/gphoto2 --set-config /main/actions/viewfinder=1
/usr/bin/gphoto2 --set-config /main/settings/capturetarget=1
av=$(/usr/bin/gphoto2 --get-config /main/capturesettings/aperture | grep Choice | cut -d ' ' -f 2 | tr '\n' ' ')
for value in ${array[*]}
/usr/bin/gphoto2 --set-config-index /main/capturesettings/aperture=$value
sleep 1
/usr/bin/gphoto2 --capture-image
/usr/bin/gphoto2 --set-config /main/actions/viewfinder=0
1 Like

(Andreas Schneider) #25

Robert, I don’t really get what that script is for shooting the vignetting pictures?


(Robert Stephan) #26

Well, thats easy to answer. The Vignette is not the same at each aperture. Also not at each fokus distanz. But i think i will take only pictures with fokus infinite. Transversal chromatic aberrations differs also, i think so. So i need pictures with different aperture. And in order not to have to touch the camera for every shot I decided to solve it with a script.


(Andreas Schneider) #27

But if you calibrate a zoom lens you need to adjust the camera for each distortion image you take …


(Robert Stephan) #28

I know, I’ve done that in the past. But only to get values for correcting the distortion. I have not yet found an optimal motif for transversal chromatic aboration. That’s why my request for support. Hints on suitable motifs or buildings would help me already.
The zoom lenses need then just a manual intervention, because I have no way to solve the remote control. Focus position can be solved by script, which is only good for the vignette.



(George) #29

Does the orientation matter for the vignetting photos? Despite the fact that I made the photos with the camera at almost 90 degrees up, it has recorded some of them as portrait.


(lee) #31

For the US, I now order white diffusion plastic from here:

The 2447 in 1/8 or 3/16 inch thickness works well. Transmission density for the different thicknesses is on the ordering page. Service is fast and shipping cost reasonable.

In the 80’s I got pieces out of the scrap bin at a local supplier in Minneapolis for pennies or free.

1 Like

(lee) #32

I do the same with a building near me with sharp creases in metal siding. It works very well. It helps to have the siding fill the frame and to have direct sun casting sharp shadows.


(Andreas Schneider) #33

I dunno, I made sure that it is in landscape mode by checking after the first picture.



@asn thank you for the tutorial.
I’m puzzled about distance from the subject to measure distortion. I have read/watched the lensfun links and on the vimeo screencast there is a sentence (more or less): “some lens have strange distortions when the subject is close so the recommend distance is no less than 8 meters”

Does anybody know which lenses have this issues?

What is the point of standing 8m from target (here, lines) for portrait lens if normal usage is let’s say 1 meter?

I thinking about profiling my m43 prime lenses (15mm, 20mm, 25mm, 42.5mm all Panasonic) using flipchart (which is 70x100cm) but if I need to be really at 8m away than I must go outdoors.

The other question is if vertical lines can be also measured and taken into consideration?

I definitely want to measure vignetting and add this to lensfun since it’s missing for my lens.


(Andreas Schneider) #35

The point of standing 8 meters away is that you get correct pictures for calibration. This has nothing to do with the shortest focus distance. You can try with the flip chart but if they are not correct don’t wonder why … :wink:



This 8 meters bothers me so I took a trip to imatest webpage for any guidance. The charts they’re using (and selling) to measure distortion are not that big so you can take a picture from 8 meters and fill the frame. I assume that those 8m is just a rule of thumb.

Other thing is that m43 lenses have encoded correction parameters in firmware which is exposed in exif but the full format of it is still unknown.



Small update here. What I learnt, at least for my m43 prime lenses, is that infinity is the worst case for vignetting. Therefore after generating corrections it is worth to check how the correction behaves for the min. focus distance. There could be overcorrections in the corners. If so then the measurement for min. focus distance (say X), X * 2, X * 6 and inf should be taken for the required aperture values (kind of rule of thumb). Such approach give far more better results.

I have done vignetting measurement for Panasonic 20mm f/1.7 II and overcorrections were clearly visible, thus more measurements were necessary.



Could someone explain what photos are required for a zoom lens (Sony SEL 18135)?
From the text: “For a zoom lens it is recommended to take 5 to N pictures where N is max focal length minus min focal length. You must take an image at the minimum focal length, and the maximum focal length. You can move (step backward on forward) between shots to keep the 1/3rd rule above consistent.”
My lens is 3.5-5.6/18-135. So 5 to N is 5 to 117 (135 - 18). It’s clear to me that I should take photos at 18 and 135, but I don’t see what 5 to 117 is referring to? Also what is the 1/3 rule? For distortion all the photos will be at f/8?
On my lens I have the following zooms marked: 18, 24, 35, 50, 70, 100, 135. Should I just take photos at those points rather than trying to guess other zooms? At each zoom I need to take photos at five appertures, does the attached table show the correct zoom/aperture values (for aperature, as close as I can get it to those values)? 38

Sorry if the answer is obvious, I’m new to this.


(Andreas Schneider) #39

Vignetting for professionals is documented. Do those steps for your lens, it isn’t a lot of work for primes. With a zoom lens you end up with a lot of pictures.


(Andreas Schneider) #40

Depends how much effort you want to put into the profile. Those should be fine but if you want int more accurate do it for each step. You can see the used zoom level in the EXIF if you go to the preview of the picture in your camera.

I’m also still rather new to this and feedback and suggestions to improve the document are welcome. I’ve wrote this howto because I tried to figure out all those things and thought it would be good to document what I learned in the process.
I just have a few lenses and this HOWTO covers them. Feel also free to send pull requests on github to improve the article or write them down here.


1 Like

(Andreas Schneider) #41

I’ve just added a new small feature to lens_calibrate to create preview files for the vignetting pictures to ship them in the created tarball. So lensfun maintainers can check if the pictures are not totally off …