function Par = RTKDiter(XY,pole) %-------------------------------------------------------------------------- % % RTKD (Rusu-Tico-Kuosmanen-Delp) iterative circle fit % C. Rusu, M. Tico, P. Kuosmanen, and E. J. Delp, % "Classical geometrical approach to circle fitting—review and new developments", % J. Electron. Imaging, Vol. 12, pp. 179-193, (2003) % % Input: XY(n,2) is array of coordinates of n points % % Output: Par = [a b R] is the fitting circle: % center (a,b) and radius R % % This is a non-iterative version % %-------------------------------------------------------------------------- epsilon = 0.0000001; pole1 = pole; pole2 = pole; for iter = 1:50 Par = RTKD(XY,pole2); pole3 = 2*Par(1:2)-pole2; if norm(pole3-pole1) < epsilon break; end; pole1 = pole2; pole2 = pole3; end; end % RTKDiter