Can\'t understand how to get (x\', y\') of original (x, y) in image, for Barrel/Pincushion distortion.
An approximation of the polynomial radial distortion model you can find in Fitzgibbon, 2001 is
where rd and ru are the distances from the center of distortion. This is also used to filter the distortion out of a wide-angle camera image for computer vision and image processing purposes.
You can find a more detailed explanation of the principle and the shader code to implement the undistortion filtering (and also the forward transformation) here: http://marcodiiga.github.io/radial-lens-undistortion-filtering
I'm also posting the papers you should take a look at if you want to know the mathematical details for the method I posted