Search code examples
algorithmmatlabsift

Calculate Mapping of Nearest Points of 2 matrices


I have two matrices A and B. Each of them has 2 columns having the coordinates of a point ( x , y ).

I need to compute a mapping of points from A to B such that the points have least euclidean distance among them.

Essentially I am trying to emulate what sift does on images but will not carry out the steps that sift does for matching the points...

Thus for all points in A, I compute euclidean distance with all points in B and then remove the mapping of 2 points which have the least distance. Then i continue to do this until A and B are both empty.

Could someone tell me what could be the most efficient way of doing this ?

EDIT

Can somebody help me ... The issue I am facing is that I need to compute all v/s all distances before selecting the minimum of them as the first mapping. Then I need to do this all over again making the computation really long...

Is there any way this can be done efficiently in MATLAB ?


Solution

  • Are you referring to the Procrustes distance between the two different configurations of points? If so, Matlab has a built-in function that computes the smallest-norm transformation that brings the points into alignment (this is the Procrustes distance).

    See this documentation for how to use it. If you don't have the Statistics Toolbox, then you should check the Matlab Central File Exchange first to see if anyone's written a non-toolbox version of the procrustes() function before seeking to write your own.