Undistort Performance Issues

one option is alwaysw to write some adaptive / iterative algorithm and try and try until the original functional returns values, for which you want to know the inverse. the inverse is just your best guess.

the mathematic way of solving is to write down the function and solve for another variable.
mathematica or one of these open source maths programs written in common lisp should be able to solve that in a second. as soon you wrote down the task to solve properly…

http://en.wikipedia.org/wiki/Category:Common_Lisp_software

tried to get an inverse funtion with maxima.

what i tried:

-+
me:
ratsimp([
qx = (1 + (pxpx + pypy) * (k1 + k2 * (pxpx + pypy)))px + (2pxpy)p1 + p2((pxpx + pypy)+2pxpx),
qy = (1 + (px
px + pypy) * (k1 + k2 * (pxpx + pypy)))py + p1((pxpx + pypy)+2pypy) + (2px*py)*p2]);
±

-+
it:
[qx=k2pxpy^4+(2k2px^3+k1px+p2)py^2+2p1pxpy+k2px^5+k1px^3+3p2px^2+px,
qy=k2
py^5+(2k2px^2+k1)py^3+3p1py^2+(k2px^4+k1px^2+2p2*px+1)py+p1px^2]
±

-+
me:
solve(%, [px, py](px, py));
±

-+
it:
`algsys’ cannot solve - system too complicated. – an error. To debug this try debugmode(true);
±

so it didn’t work.

next thing to try would be an adaptive algorithm

adaptive approach.

the patch and the plugin.

please checkout the plugin for more info on the adaptive approach.

testDistort.v4p (39.0 kB)
Undistort.dll (24.6 kB)

excellent, the algorithm seems to fit the problem very well, as the translated coordinates are close to the original ones.
maple gave me a 2 pages long expression for tthe inverse function, that was not applicable…

wow! Hats off to you guys! All a little over my head but interesting reading. Just another day at the office for you guys I think.

I won’t have my installation setup again for another week and I’ll run some tests with this new working version.

Thanks for all you’re hard work