Plotting lens distortion on a radial curve

I’m hoping someone can help me, I’ve completed a lens calibration on a Distagon lens and
I would like to convert the lens distortion matrix into a radial distortion curve, similar to these plottings. https://lenspire.zeiss.com/photo/app/uploads/2018/04/Article-Distortion-2009-EN.pdf

I am hoping I can verify the accuracy of the distortion curve using the openCV calibrations. Is there a method for generating or comparing these?

lens distortion coefficients are a list of numbers. the matrix is a projection matrix.

find the equations for radial distortion in the OpenCV documentation.

Thanks crackwitz,

I’m learning much here. I am getting a curve (using CALIB_ZERO_TANGENT_DIST), but many things are confusing me.

How can I get the X to be in mm and the Y to be in %?

The lens has barrel distortion and the radial distortion plot is trending negative % away from x=0mm. Which is correct.

My k1 k2 k3 values
Distortion coefficient: [[-0.04025535 -1.3923953 0. 0. 15.12999711]]

when plotted in Octave p = [ 15.12999711 0 -1.3923953 0 -0.04025535 0 1 0 ]; , the curve trends upwards. Will the k1k2k3 show positive values on the plot for barrel/pincushion? If so, how do I invert this?

Thank you.

the paper states once in passing:

However, in the 24x36 rectangle of the 35 mm format […]

so they probably use mm (or percent) of distortion in a “35 mm” picture, which is physically 36x24 mm in size. the largest distance is from center to a corner, which is ~21.6 mm. I expect the plots in that paper to have that range, and you’ll find that “21.6” number in many of their number examples.

most cameras aren’t like that. OpenCV works with pixels.

you didn’t say what each number in your given vectors means. are they really in the standard order of distCoeffs from OpenCV? what’s the size of your picture in pixels?

using numbers from the tutorial (the XML/YAML file shown at the end) and equations from the documentation above (omitting zero coefficients), I get this picture:

distortion factor over true radius (take difference to 1.0 as error):
image

distorted radius over true radius:
image

(the example uses a 640x480 picture, so the maximum radius is 400 pixels)

1 Like