Introduction:
Homography can be obtained from 4 pairs of points with 100 percent accuracy (error 0 representing 0). However, when the number of pairs of points is greater than 4, you may not be able to get a 0-error homography. This is because points cannot be in the same 3D glider.
So, first you need to deal with the fact that in the application of a real word there cannot be 100% accurate homography (due to coincidence of errors), but there is one optimal (minimum matrix of repetition errors).
Structure:
As for your question, it seems that you have two sets of point pairs. One of them that you used to get Homography, and another that you test on your model based on this, and then you want to use it to improve your model.
How to improve homography?
First use both sets to get homography using some reliable assessment method (e.g. RANSAC). You can find more information here .
Secondly, iterate over your set and compute the reprogramming error for each point as you described. Then eliminate all points where the reproductive error is greater than some threshold.
Thirdly, apply fine tuning optimization methods only on tabs until you get a good homography as the sum of the errors among the rulers.
How to take the third step?
You have 8 parameters for optimization:
h11 h12 h13 h21 h22 h23 h31 h32 1
Optimization Function:
And you have already calculated Homography using RANSAC. So, you have a very good rating, which is close to the global optimal . This means that for this case, nonlinear local optimization is sufficient. There are many algorithms. Pick one and get started (Some suggestions: Hill Climbing , Simulated Annealing )
Change after the OP comment that only the distances between the second set are known:
The optimization function should be:
Where AD_ij
is the actual distance between Pi and Pj.
You can try to reduce complexity, for example, by using the Euclidean distance sequence for reference and query.