Convert Brown-Conrady lens calibration parameters to the format used by ImageMagick

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Photointerpreter
Posts: 2
Joined: 2015-10-28T16:32:12-07:00
Authentication code: 1151

Convert Brown-Conrady lens calibration parameters to the format used by ImageMagick

Post by Photointerpreter »

Good evening,

I have to rectify a series of images produced by a drone camera. I have a camera calibration file supplied with the images containing the distortion parameters following the Brown-Conrady model: Symmetrical distortion parameters in the form of a polynomial (K0,K1,K2,K3 of the even terms) and tangential distortion parameters.

The distort -barrel option of the ImageMagick convert command uses a different lens distortion model, in fact the same that is used in the PTLens software. Is it possible to convert from one model (Brown-Conrady) to the PTLens model using some transformation equations, or either to use the lens distortion parameters following the Brown-Conrady model directly in Imagemagick ?

Thanks in advance,

Jean Vezina
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert Brown-Conrady lens calibration parameters to the format used by ImageMagick

Post by fmw42 »

Is it possible to convert from one model (Brown-Conrady) to the PTLens model using some transformation equations,
I would not know how, since the current IM model only seems to include radial distortion and not tangential (torsional) distortion. You should be able to use just K1 and K2 terms in Imagemagick to do the radial distortion correction. Try comparing the order of terms in the two sets of equations. http://www.imagemagick.org/Usage/distorts/#barrel and https://en.wikipedia.org/wiki/Distortion_(optics). But I think A=0, B=K1, C=0 and D=1, but IM is missing the r^4 term. So I do not know what to do with K2. (My script pinbarrel at my link below will be slow, but does allow for a r^4 term).

From the reference below:

"Experience shows that the effects of radial lens distortion f(r) exceed those of torsional distortion g(r,α) at least by an order of magnitude. Consequently, most software only models radial distortion"

(see http://www.imagemagick.org/Usage/lens/c ... rtions.pdf). Perhaps your camera system is in the PTlens data base or can be added. Also you might inquire of someone more expert in the area such as the author Wolfgang Hugemann (whugemann on this forum) or Professor Helmut Dersch (http://webuser.fh-furtwangen.de/~dersch/)
or either to use the lens distortion parameters following the Brown-Conrady model directly in Imagemagick ?
It is certainly possible, but would require new implementation. I do not think this would be high priority for the IM developers, but they would have to comment. But any one can contribute code.
Photointerpreter
Posts: 2
Joined: 2015-10-28T16:32:12-07:00
Authentication code: 1151

Re: Convert Brown-Conrady lens calibration parameters to the format used by ImageMagick

Post by Photointerpreter »

Good morning,

Thanks a lot!

I will try your suggestion.

Best regards,

Jean
Post Reply