Cheap and Secure Web Hosting Provider : See Now

, ,
Problem Detail:

I'm trying to understand the math behind correcting a radial distortion (caused by a lens), but I'm failing to have it explained in simple terms.

I found several examples that proceed this way: a starting point $P = (x, y)$ is given and it is transformed to another point $P'=(x', y')$ with the following equations

\begin{align*} x' &= x \cdot (1-a \cdot \|P\|) \\ y' &= y \cdot (1-b \cdot \|P\|)\,. \end{align*}

This causes radial distortion, depending on the constants $a$ and $b$. Here $\|P\|$ is the euclidean norm of the vector from the origin to the point P, i.e. $\|P\|=\sqrt{x^2 + y^2}$.

How can I invert these equations? In other words, given $x',y'$, I want to get back $x,y$.

###### Answered By : Yuval Filmus

I'm not sure inverting these equations will help you gain any understanding. Consider for example the simple case in which $a = b$. In that case, $$x'^2 + y'^2 = (x^2 + y^2) (1- a\|P\|)^2 = \|P\|^2(1-a\|P\|)^2,$$ and taking square roots, $$\sqrt{x'^2+y'^2} = \|P\|\,\big|1-a\|P\|\big|.$$ You know the left-hand side. The right-hand side is either $\|P\|(1-a\|P\|)$ or $\|P\|(a\|P\|-1)$ (though I'm not sure the latter is physically possible in your case), and in each case you get a quadratic for $\|P\|$. You get at most four solutions for $\|P\|$, and for each positive one you can substitute back, calculate $x,y$, and check that the equations are satisfied.

The case $a \neq b$ looks more complicated, but perhaps can be solved explicitly using a bit of creative algebra. Failing that, there are numerical method that can invert these equations.