http://www.mathworks.com/matlabcentral/newsreader/view_thread/325202
MATLAB Central Newsreader  Alignment of 3D Points
Feed for thread: Alignment of 3D Points
enus
©19942014 by MathWorks, Inc.
webmaster@mathworks.com
MATLAB Central Newsreader
http://blogs.law.harvard.edu/tech/rss
60
MathWorks
http://www.mathworks.com/images/membrane_icon.gif

Fri, 14 Dec 2012 04:06:08 +0000
Alignment of 3D Points
http://www.mathworks.com/matlabcentral/newsreader/view_thread/325202#893712
Anusha
I have two sets of 3d points (in x,y,z) coordinates. How can I align these two points into a same reference point, maybe using a centroid?<br>
<br>
Thanks

Fri, 14 Dec 2012 04:30:08 +0000
Re: Alignment of 3D Points
http://www.mathworks.com/matlabcentral/newsreader/view_thread/325202#893715
Matt J
"Anusha " <anusha@cs.usm.my> wrote in message <kae8jg$rao$1@newscl01ah.mathworks.com>...<br>
> I have two sets of 3d points (in x,y,z) coordinates. How can I align these two points into a same reference point, maybe using a centroid?<br>
=============<br>
<br>
You can use this,<br>
<br>
<a href="http://www.mathworks.com/matlabcentral/fileexchange/26186absoluteorientationhornsmethod">http://www.mathworks.com/matlabcentral/fileexchange/26186absoluteorientationhornsmethod</a>

Fri, 14 Dec 2012 04:49:09 +0000
Re: Alignment of 3D Points
http://www.mathworks.com/matlabcentral/newsreader/view_thread/325202#893717
Roger Stafford
"Anusha " <anusha@cs.usm.my> wrote in message <kae8jg$rao$1@newscl01ah.mathworks.com>...<br>
> I have two sets of 3d points (in x,y,z) coordinates. How can I align these two points into a same reference point, maybe using a centroid?<br>
> <br>
> Thanks<br>
        <br>
You may be interested in matlab's 'procrustes' function in the Statistics Toolbox. It determines the linear transformation of one set of points to another set that produces the least sum of squares differences between the two sets.<br>
<br>
Roger Stafford

Fri, 14 Dec 2012 14:40:09 +0000
Re: Alignment of 3D Points
http://www.mathworks.com/matlabcentral/newsreader/view_thread/325202#893737
Anusha
"Roger Stafford" wrote in message <kaeb45$4j0$1@newscl01ah.mathworks.com>...<br>
> "Anusha " <anusha@cs.usm.my> wrote in message <kae8jg$rao$1@newscl01ah.mathworks.com>...<br>
> > I have two sets of 3d points (in x,y,z) coordinates. How can I align these two points into a same reference point, maybe using a centroid?<br>
> > <br>
> > Thanks<br>
>         <br>
> You may be interested in matlab's 'procrustes' function in the Statistics Toolbox. It determines the linear transformation of one set of points to another set that produces the least sum of squares differences between the two sets.<br>
> <br>
> Roger Stafford<br>
<br>
But I have different number of point for set A and set B. Can procrustes can be done on this case? I prefer to align them to a standard coordinate system, let say mayb on a given center of gravity.

Fri, 14 Dec 2012 15:38:08 +0000
Re: Alignment of 3D Points
http://www.mathworks.com/matlabcentral/newsreader/view_thread/325202#893746
Matt J
"Anusha " <anusha@cs.usm.my> wrote in message <kafdo9$cub$1@newscl01ah.mathworks.com>...<br>
><br>
> But I have different number of point for set A and set B. Can procrustes can be done on this case? I prefer to align them to a standard coordinate system, let say mayb on a given center of gravity.<br>
=================<br>
<br>
Assuming A is 3xN and B is 3xM, you can translate the centroid of B to coincide with the centroid of A as follows<br>
<br>
Bnew=bsxfun(@plus,B,mean(A,2)mean(B,2));<br>
<br>
It's not clear, though, why you're only asking about aligning the centroids. What information is there about the rotation of A relative to B and why don't you care about it?

Fri, 14 Dec 2012 16:18:08 +0000
Re: Alignment of 3D Points
http://www.mathworks.com/matlabcentral/newsreader/view_thread/325202#893751
Anusha
"Matt J" wrote in message <kafh50$onj$1@newscl01ah.mathworks.com>...<br>
> "Anusha " <anusha@cs.usm.my> wrote in message <kafdo9$cub$1@newscl01ah.mathworks.com>...<br>
> ><br>
> > But I have different number of point for set A and set B. Can procrustes can be done on this case? I prefer to align them to a standard coordinate system, let say mayb on a given center of gravity.<br>
> =================<br>
> <br>
> Assuming A is 3xN and B is 3xM, you can translate the centroid of B to coincide with the centroid of A as follows<br>
> <br>
> Bnew=bsxfun(@plus,B,mean(A,2)mean(B,2));<br>
> <br>
> It's not clear, though, why you're only asking about aligning the centroids. What information is there about the rotation of A relative to B and why don't you care about it?<br>
<br>
Actually what I need to do is aligning A and B into a standard coordinate system. When I say aligning to the centroid, it means that during aligning A and B to standard coordinate, maybe the centroid of either A or B can be utilized to give the center of gravity for alignment. Hope Im making myself clear.

Fri, 14 Dec 2012 16:40:09 +0000
Re: Alignment of 3D Points
http://www.mathworks.com/matlabcentral/newsreader/view_thread/325202#893755
Matt J
"Anusha " <anusha@cs.usm.my> wrote in message <kafjg0$3ta$1@newscl01ah.mathworks.com>...<br>
><br>
> Actually what I need to do is aligning A and B into a standard coordinate system. When I say aligning to the centroid, it means that during aligning A and B to standard coordinate, maybe the centroid of either A or B can be utilized to give the center of gravity for alignment. Hope Im making myself clear.<br>
============<br>
<br>
No, I'm afraid not. What makes you think A and B aren't already measured in the same coordinate system right now? After all, they're already both in R^3 and R^3 is a pretty standard coordinate system.<br>
<br>
Is A a transformation of B? If so, what does that transformation look like and why aren't there the same number of points before and after the transformation?

Fri, 14 Dec 2012 20:28:08 +0000
Re: Alignment of 3D Points
http://www.mathworks.com/matlabcentral/newsreader/view_thread/325202#893765
Roger Stafford
"Anusha " <anusha@cs.usm.my> wrote in message <kafjg0$3ta$1@newscl01ah.mathworks.com>...<br>
> Actually what I need to do is aligning A and B into a standard coordinate system. When I say aligning to the centroid, it means that during aligning A and B to standard coordinate, maybe the centroid of either A or B can be utilized to give the center of gravity for alignment. Hope Im making myself clear.<br>
         <br>
Anusha, you still haven't defined to my satisfaction what you mean by "aligning A and B into a standard coordinate system" where A and B are two sets of points. Just what do you mean by this? Taken by itself it is not a description that I am familiar with.<br>
<br>
The only thing I can think of that you might conceivably mean is to locate the centroid of each set at the origin of a system of cartesian coordinates and align their three principal moments of inertia with the coordinate axes with, say, the largest moment along the xaxis and smallest along the zaxis, assuming the points have equal mass  or something like that.<br>
<br>
In answer to your question about procrustes, yes, it does require that the two sets have the same number of points. That is needed to make sense out of the kind of processing that it performs.<br>
<br>
Roger Stafford

Sat, 15 Dec 2012 15:43:08 +0000
Re: Alignment of 3D Points
http://www.mathworks.com/matlabcentral/newsreader/view_thread/325202#893784
Anusha
"Matt J" wrote in message <kafkp8$83i$1@newscl01ah.mathworks.com>...<br>
> "Anusha " <anusha@cs.usm.my> wrote in message <kafjg0$3ta$1@newscl01ah.mathworks.com>...<br>
> ><br>
> > Actually what I need to do is aligning A and B into a standard coordinate system. When I say aligning to the centroid, it means that during aligning A and B to standard coordinate, maybe the centroid of either A or B can be utilized to give the center of gravity for alignment. Hope Im making myself clear.<br>
> ============<br>
> <br>
> No, I'm afraid not. What makes you think A and B aren't already measured in the same coordinate system right now? After all, they're already both in R^3 and R^3 is a pretty standard coordinate system.<br>
> <br>
> Is A a transformation of B? If so, what does that transformation look like and why aren't there the same number of points before and after the transformation?<br>
<br>
Actually A and B represents points on a surface of medical structure. Capturing the medical structure at different time wil not provide an aligned point set representastion. I have checked this, and the structure A and B are not aligned at the same axis. thts why I need to aligned them to a common axis/center of gravity so tht further processing can be done.

Sun, 16 Dec 2012 01:15:10 +0000
Re: Alignment of 3D Points
http://www.mathworks.com/matlabcentral/newsreader/view_thread/325202#893801
Roger Stafford
"Anusha " <anusha@cs.usm.my> wrote in message <kai5qc$1ad$1@newscl01ah.mathworks.com>...<br>
> Actually A and B represents points on a surface of medical structure. Capturing the medical structure at different time wil not provide an aligned point set representastion. I have checked this, and the structure A and B are not aligned at the same axis. thts why I need to aligned them to a common axis/center of gravity so tht further processing can be done.<br>
         <br>
You are still making that same statement without defining what you mean! You have said, "I need to aligned them to a common axis/center of gravity". A set of points does have a centroid, we can agree on that, but that still leaves the point set with two degrees of freedom to rotate about that centroid. What do you mean by the "common axis" of the sets? I suggested using their principal moments of inertia which would indeed define a canonical set of orthogonal axes, provided all three were different, but so far you haven't responded to that suggestion. Do you have any other inherent axes that can be associated with a 3D point set? To put the question loosely, which way is inherently "up", which way is "in front", and which way is "to the side" for an abstract set of threedimensional points of arbitrary orientation in some coordinate system?<br>
<br>
Roger Stafford

Sun, 16 Dec 2012 07:46:15 +0000
Re: Alignment of 3D Points
http://www.mathworks.com/matlabcentral/newsreader/view_thread/325202#893806
Matt J
"Anusha " <anusha@cs.usm.my> wrote in message <kai5qc$1ad$1@newscl01ah.mathworks.com>...<br>
><br>
> > Is A a transformation of B? If so, what does that transformation look like and why aren't there the same number of points before and after the transformation?<br>
> <br>
> Actually A and B represents points on a surface of medical structure. Capturing the medical structure at different time wil not provide an aligned point set representastion. <br>
================<br>
<br>
<br>
If you're dong surfacetosurface registration, there are some possibly applicable contributions on the FEX. Some examples are<br>
<br>
<a href="http://www.mathworks.com/matlabcentral/fileexchange/27804iterativeclosestpoint">http://www.mathworks.com/matlabcentral/fileexchange/27804iterativeclosestpoint</a><br>
<br>
<a href="http://www.mathworks.com/matlabcentral/fileexchange/12627iterativeclosestpointmethod">http://www.mathworks.com/matlabcentral/fileexchange/12627iterativeclosestpointmethod</a>