as the pic says,left is the distort pixel,right is the undistort pixel,r = root of (xx + yy),k is radial coefficients,p is tangential distortion coefficients.
if we know right,we can get the corresponding left without iterating.
if we know left,it is hard to get right,we can get it through iterating.but i wonder why we can get it by iterate(as far as i know,it must be convergent),so anyone can explain it in math theory/formula?
The distortion function is modeled as a Taylor series. I think you could just swap the order of the distorted / undistorted coordinates and compute an inverse function, too. Without an inverse function, though, you have to come up with some other way to undistort points, and an iterative approach works. A word of warning: 5 iterations is not enough if your lens has significant distortion. Newer versions of OpenCV accept a TermCriteria parameter which allows you to specify max iterations. When I care about accuracy (which is pretty much always) I set the maximum iterations quite high. I use 40. For my lens it makes a huge difference compared to 5
I’m not sure it is guaranteed to converge in all cases, but if you are working in a well-behaved region of the distortion function, it will converge. My understanding of how the distortion function works is that it it maps undistorted radius (distance from the image center to a given point) to a distorted radius - this tells you how much closer / further from the center the distorted point is.
The function can’t be correctly inverted by simply taking the reciprocal of the rational expression, but you can get a reasonable estimate by doing this. You then fine-tune the estimate by iterating, making smaller and smaller adjustments at each iteration. I think this works in most cases because your first estimate is a reasonable starting point for the search.
If you are looking for a proof that it will converge (or under which conditions it will/won’t converge), I don’t have anything for you. If you do find something, please share it - I would be interested to learn more.