Assume I have the following lens distortion function:
$$ x' = x (1 + k_1 r^2 + k_2 r^4) \\ y' = y (1 + k_1 r^2 + k_2 r^4) $$
where $r^2 = x^2 + y^2$. Given coefficients $k_1$ and $k_2$, I need to calculate the inverse function:
$$ x = f(x') = \, ?\\ y = f(y') = \, ? $$
This inverse function can be an estimate as well, e.g., a polynomial function whose coefficients can be calculated with numerical methods.
My problem is the following:
Given a picture, generate another picture by simulating lens distortion. I want to create another program, which given the output of the first one and the coefficients of the lens distortion function used, will calculate the original image.
First I tried:
$$ x = { x' \over 1 + k_1r'^2 + k_2r'^4}\\ y = { y' \over 1 + k_1r'^2 + k_2r'^4} $$
However, since $r'^2=x'^2+y'^2\neq r^2$, this won't give the original values of $x$ and $y$.
I was thinking then if I can use a similar formula, but different coefficients:
$$ x = x' (1 + k'_1r'^2 + k'_2r'^4)\\ y = y' (1 + k'_1r'^2 + k'_2r'^4) $$
where $k'_1$ and $k'_2$ would be calculated from $k_1$ and $k_2$.
But I'm open to any suggestion.
please see this link (http://www.mdpi.com/1424-8220/16/6/807/pdf).
In this article, the authors present a new approach to calculating the inverse of radial distortions. The method presented there provides a model of reverse radial distortion, currently modeled by a polynomial expression, that proposes another polynomial expression where the new coefficients are a function of the original ones.