Overlaying and Comparing Two Sets of Co-Ordinates

14 views (last 30 days)
Hello all
I have been using Matlab as a fancy calculator for some time now but always wanted to do more with it.
So part of trying to learn Matlab I was wanted to tackle an actual problem which I was hoping the community could help with.
I have 2 x sets of data, they are data set 1 and data set 2.
Data set 1contains a list of X Y co-ordinates (which I have created a matrix for), the data relates to an outline of a building.
Data set 2 also contains a list of X Y co-ordinates (which I have also created a matrix for), this data relates to the outline of the same building, the only difference is that data set 2 contains more data X Y co-ordinates and the values of each X and Y differ slightly.
Plotting these data sets gives me the following:-
What I am trying to do is overlay data set 2 with data set 1 such that the best fit is found.
Once the images are overlaid as best as they can I then want to compare the original X Y co-ordinates of data set 2 with the adjusted/best fit co-ordinates of data set 2 to see the difference.
I am struggling with how to overlay the two sets of co-ordinates to produce a best fit – any ideas?
Thank you.
  2 Comments
Matt J
Matt J on 13 Apr 2019
What kind of transformations of data set 2 (to match data set 1) are you willing to allow? Translations? Rotations? Something even more complicated?
John hope
John hope on 14 Apr 2019
Hi Matt
The allowable transformations include:-
1) +ve & -ve translations
2) Reflection
3) Rotation
4) Mirroring
Any type of Scaling i.e Dilation/Compression/Contraction is not allowed
thoughts?
Thanks

Sign in to comment.

Accepted Answer

Matt J
Matt J on 14 Apr 2019
Edited: Matt J on 14 Apr 2019
I haven't used it myself, but this implementation of Iterative Closest Point seems pretty popular
  4 Comments
John hope
John hope on 15 Apr 2019
Hi Matt
Your right it was part of the example and I managed to work out that the code simply offsets the data.
Can i ask, the function takes in the model and data as inputs (as well as other inputs) but i wanted to ask from the code how can you tell which input data set is fixed and which is translated?
I am trying to map one data set onto the other, so i have data set 1 which remains fixed and data set two which is the dataset that floats & maps onto data set 1.
So does model represent the fixed data set and data represent the "floating" data set?
Thanks
Matt J
Matt J on 15 Apr 2019
I deduce from this section of the help docunentation
% OUTPUT:
%
% R - rotation matrix
% T - translation vector
% data2 - matrix with transformed data points, [ P_1 P_2 ... P_N ]
%
% data2 = R*data + T
that the "data" input (not the "model") is the data that floats. It is "data" to which the rotation and translation are being applied at the very end.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!