A method for correcting a nonlinear distortion in an image includes
receiving an image of a calibration template comprising calibration
patterns, detecting at least three points from the calibration patterns,
calculating a distortion parameter from coordinates of the at least three
points that should align along a straight line, and correcting the
nonlinear distortion in the image using the distortion parameter. A
method for correcting a radial distortion in an image includes receiving
a radial distortion parameter from the user and calculating new intensity
values of points in the image to correct a radial exposure distortion in
the image.