INPUT: two images and n correspondences |
//Initialization |
(1) | vector_inx = [1:n] |
(2) | bestMod = |
(3) | vector\_inr = |
(4) | minNFA = |
(5) | nIter=(nIterRe = nIter/10) |
(6) | nData = x1.ncol () |
(7) | errorMax = 0 |
| //Main estimation loop |
(8) | for Iters = 0 to nIters do |
(9) | vector_sp = USample (size_Sample, vector_inx) |
(10) | vector_mods = Fit (vector_sp) |
(11) | end for |
| //Evaluate Models |
(12) | better = false//Whether one of the tested models improves the NFA |
(13) | for k = 0 to vector_mods.size do |
(14) | error = Error (vector_mods[k]) |
| //Residuals computation and ordering |
(15) | for i = 0 to nData do |
(16) | error = Error (vector_mods[k]) |
(17) | vector_res = ErrorIndex (error) |
(18) | sort (vector_res) |
(19) | end for |
(20) | end for |
//Statistical detection of the best meaningful subset (inliers/outliers) |
(21) | ErrorIndex.best = bestNFA |
| //Find a better model |
(22) | if (best.error < minNFA), then |
(23) | minNFA = best.error |
(24) | vector\_inr.resize (best, inx) |
(25) | end if |
(26) | for i = 0 to best.index do |
(27) | vector_inr[i] = vector_res[i].index |
(28) | errorMax = vector\_res[best.index-1].error//Error threshold |
(29) | bestMod = vector_mod[k] |
(30) | better = true |
(31) | precision = denormalizeError (errorMax) |
(32) | end for |
| //Optimization |
(33) | If (better and minNFA < 0) or (Iter + 1 = nIterRe), |
then |
(34) | vector_inx = vector_inr |
(35) | if (nIterRe), then |
(36) | nIter = Iter+1+nIterRe |
(37) | nIterRe = 0 |
(38) | end if |
(39) | end if |
(40) | return bestMod, vector_inr, minNFA, precision |