# Correcting image distortion by warping a set of distorted points to a corresponding set of undistorted points

I was hoping someone might be able to help me undistort an image in Mathematica. The distortion doesn't follow any specific pattern, but there are several points on the distorted image that I am able to extract. I also have the corresponding set of corrected, undistorted points. My question is how to warp the distorted image in such a way as to match the distorted points with the undistorted set of points, therefore correcting the distortion. I tried using an old warp matrix command from Mathematica 6, but it was not as faithful as I would like. Any ideas? Thanks in advance!

This is my current code, but it isn't as faithful as I would like:

Wf = WarpMatrix[Reverse /@ dpoints, Reverse /@ ppoints, 3];
MatrixForm[Wf];
newimg = ImageWarp[img, Wf, InterpolationOrder -> 3]

• Hi ! If you have any relevant code, please, add it. Feb 25, 2015 at 21:43
• ImageTransformation[image,function]. Feb 25, 2015 at 21:51
• This is my current code, but it isn't as faithful as I would like: Wf = WarpMatrix[Reverse /@ dpoints, Reverse /@ ppoints, 3]; MatrixForm[Wf]; newimg = ImageWarp[img, Wf, InterpolationOrder -> 3] Feb 25, 2015 at 21:57
• I tried the ImageTransformation command, but I'm not sure how to create a function relating my distorted set of points to my undistorted set. Any suggestions? Feb 25, 2015 at 21:58
• In order to construct a transformation function, you'll need to know what form the transformation takes. Maybe you can post examples of a distorted and undistorted image, or at least the pairs of points in the two images. Feb 25, 2015 at 23:21