Overview
The problem is perhaps a very easy one for a trained mathematician. As I am not a mathematician, but instead a researcher in general problem solving, I am reaching out to those who know more than I in an effort to solve a problem. The mathematics are known to me in a simpler form of the solution and it all relates to a set of operations used in optics: radial lens distortion. I have a function: $y=f(x)$. I need the inverse function such that: $x=f'(y)$.
The Data
A few websites give a good review of the equations in a simpler form:
- paulbourke.net/miscellaneous/lenscorrection/
- en.wikipedia.org/wiki/Distortion_%28optics%29
- www.imagemagick.org/Usage/lens/correcting_lens_distortions.pdf
- See Page 3
- This post asks the same question, but with less contextual data
Definition of Terms
- $ \vec\alpha$
- non-normalized vector from $\displaystyle Pixel\_current_{x,y}$ to $\displaystyle Pixel\_center_{x,y}$
- $ \beta$
- length of $\vec\alpha$
- $k_i$
- The $i$-th coefficient of the distortion parameter series
- $P_{(x,y)}$
- Undistorted Pixel Location
- $Q_{(x,y)}$
- Distorted Pixel Location
List of Known Functions
The radial distortion function is in the form of:
FUNCTION 1:: $ P_{(x,y)} = Q_{(x,y)} \times ( \displaystyle 1 + \displaystyle\sum_{i=1}^\infty(k_i × \beta^{2i} )) $
Most implementations contain only the first two distortion terms, and thus looks like:
FUNCTION 2:: $ P_{(x,y)} = Q_{(x,y)} \times (1 + k_1\beta^2)$
I've found a working inverse function for FUNCTION 2:
FUNCTION 3:: $ Q_{(x,y)} = \displaystyle \frac {P_{(x,y)}} {1 - k_1 \times \displaystyle \left\| \frac{\vec\alpha}{1 - k_1 \times \left\|\vec\alpha\right\|^2} \right\|^2}$
FUNCTION 3 works beautifully as long as I don't need a second distortion coefficient, or the second term of the original Taylor series.
The Request
1.
What I’m looking for is a reciprocal function that accounts for the first two terms of the Taylor series, the inverse of:
FUNCTION 4:: $P_{(x,y)} = Q_{(x,y)} \times \left( 1 + k_1 \times \left\|\vec\alpha\right\|^2 + k_2 \times \left\|\vec\alpha\right\|^4 \right) $
2.
I need a version of the formula that I can write into computer code using a list of operators defined on this page; in addition to standard operators like: $+ - \times \div \left( \right)$, etc. So, every step needs to be broken down into single instructions. Again, my math-fu is limited.
There is no analytic solution.
See this paper for a proposed technique, along with citations to the literature for other techniques. (there are many other papers out there, this is one of the first that popped up for me in google).
http://www.researchgate.net/profile/YangQuan_Chen/publication/220436724_Rational_Radial_Distortion_Models_of_Camera_Lenses_with_Analytical_Solution_for_Distortion_Correction/links/0912f50c3db1b103c8000000.pdf
I've used the technique in the following paper, but I am not sure if that is available for free, so I will just cite it.
Geometric camera calibration using circular control points. IEEE Transactions on Pattern Analysis and Machine Intelligence, 22(10):1066–1077, 2000