Page 1 of 1

ideal parameters for -distort Barrel correction?

Posted: 2013-07-22T12:48:35-07:00
by airBourne
I've read thru the IM Lens Correction page (http://www.imagemagick.org/Usage/lens/) and Dersch's page and need a little help figuring out transformation parameters to do a proper barrel distortion correction. My raw images are Hasselblad H4D-50 .3fr images that I've converted to TIFF using dcraw. I have the following camera calibration parameters provided to me from Hasselblad:
Focal Length 8450.200450379736 pixel (50.7 mm)
Principal Pt xp 4081.938998397167 pixel
Principal Pt yp 3049.108644739739 pixel

Radial_1 -0.084086506315842
Radial_2 0.205627582811823
Radial_3 -0.385333159221336
Tangent_1 -0.000646847534623633
Tangent_2 0.000700697532591567
From these parameters, above, is it possible to calculate ideal parameters for IM's barrel distortion correction? My images are digital aerial photographs from a remote location with few linear features; I can play with various settings in IM to get rough approximations of what I want, i.e.:

Code: Select all

-distort  Barrel  "0.0  0.0  -0.015  1.015"
but I thought there might be a more quantitative approach to arrive at these values based on the parameters provided by Hasselblad. If I use Hasselblad's Phocus software to export the images from .3fr to TIFF, I can select a "lens correction" option that does (among other things?) a barrel distortion correction. This feature is poorly documented in the User Manual, so I'm not really sure what's happening behind the scenes, but the corrected TIFF images have a small barrel distortion correction applied, as evident by comparing corrected vs. non-corrected images. I arrived at the values above (0 0 -.015 1.015) by comparing images created using the IM barrel correction to Hasselblad's lens distortion corrected images. If there's a better way to arrive at these values, please inform.

Another thing: the raw .3fr images (and the raw TIFFs created by dcraw) are 8282x6240 with some black space around the images; when I export a TIFF using Phocus, however, these images are just 8176x6132, which is the nominal resolution of the camera. Perhaps this--and the Principal Point xp and yp--need to be considered when doing the Barrel Distortion correction to dcraw-converted TIFFs? If I add the Principal Point info from Hasselblad like so:

Code: Select all

-distort Barrel  "0.0  0.0  -0.015  1.015 4082 3049"
it has no effect on the correction, which seems odd given the center of a 8282x6240 image would be 4141,3120... much different than 4082,3049.
Anyway, any suggestions much appreciated. Thanks!

Re: ideal parameters for -distort Barrel correction?

Posted: 2013-07-25T18:58:33-07:00
by anthony
Unless you actually apply the maths to specific points so as to calculate the parameters needed, no you can not do it.

The parameters are generally looked up from a table for camera-lens used, and which was calculated by taking a photo of a grid and using a complex spreadsheet to figure out the distortion required to straighten the lines in that grid.

See the page on Lens Correction, Calabrating from Scratch whcih goes into it more
http://www.imagemagick.org/Usage/lens/#scratch

But it is not easy and I have never actually done it myself.

Re: ideal parameters for -distort Barrel correction?

Posted: 2013-07-26T07:13:50-07:00
by airBourne
Thanks Anthony, I had already read the "Calibration from Scratch" page, but as you said:
anthony wrote:it is not easy
:)

so I thought I might be able to skip this and somehow use the parameters supplied by the manufacturer, above, to get the proper values. Thanks for the tip!

Re: ideal parameters for -distort Barrel correction?

Posted: 2013-07-26T07:43:49-07:00
by snibgo
The Hugin toolset can be used fairly easily to get the a,b,c radial parameters for a given lens at a given focus (and given zoom, if appropriate).

However, these don't correspond to any of the five parameters in the OP. I don't know what those are. They seem to also have a tangential correction, which is very small compared to the radial correction.

Hasselblad would be the obvious source for an explanation. They may have a technical paper somewhere.