I&#39;m not sure I understand exactly the sequence of registrations, but I can make a quick guess.  Most likely you are sequentially registering each data set to the same reference i.e. 2 to 1, 3 to 1, 4 to 1, etc. instead of 2 to 1, 3 to 2, 4 to 3, etc.  Unfortunately, ICP can easily fall into a local minimum and fail to converge if the initial positions of the point clouds are too dissimilar. An easy fix would be to use the transform determined at the previous stage as an initial transform of the current stage.  That would keep the registration errors within about 10 degrees and should allow everything to works as expected.  <div>
<br></div><div>- Wes<br><br><div class="gmail_quote">On Fri, Jul 23, 2010 at 7:21 PM, celeste gonzalez <span dir="ltr">&lt;<a href="mailto:celgon23@gmail.com">celgon23@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<p class="MsoNormal" style="margin:0cm 0cm 10pt;line-height:normal"><font face="arial,helvetica,sans-serif"><span lang="EN-US" style="font-size:10pt">Hi everybody,</span><span lang="EN-US" style="font-size:12pt"></span></font></p>


<p class="MsoNormal" style="margin:0cm 0cm 0pt;line-height:normal"><span lang="EN-US" style="font-size:10pt"><font face="arial,helvetica,sans-serif">I want to reconstruct a 3D object via registration of stereo range data. I am using vtkIterativeClosestPointTransform to align individual point sets with respect to each other. </font></span></p>


<p class="MsoNormal" style="margin:0cm 0cm 0pt;line-height:normal"><font face="arial,helvetica,sans-serif"><font style="background-color:#ffffff"><span lang="EN-US" style="font-size:10pt"> </span><span lang="EN-US" style="font-size:12pt"></span></font></font></p>


<div><span lang="EN-US"><font style="background-color:#ffffff"><font face="arial,helvetica,sans-serif">The sequence consists of 36 images pairs constituting a full rotation of the object. I am using two consecutive points cloud with this code and then I <span>transform the source points by the matrix solution. </span></font></font></span></div>


<div><span lang="EN-US"><font style="background-color:#ffffff"><font face="arial,helvetica,sans-serif"><span></span></font></font></span> </div>

<div><span lang="EN-US"><font style="background-color:#ffffff"><font face="arial,helvetica,sans-serif"><span></span></font></font></span><font style="background-color:#ffffff"><font face="arial,helvetica,sans-serif"><span><span lang="EN-US">Initially, I took the first pair of point cloud <span> </span>then I use the point set that was aligned and a new point cloud that I wish to align</span></span><span lang="EN-US"></span></font></font></div>


<p class="MsoNormal" style="margin:0cm 0cm 0pt;line-height:normal"><font face="arial,helvetica,sans-serif"><span lang="EN-US" style="font-size:10pt">The problem is when the rotation angle it’s over 90 grades, that is, from the tenth picture the alignment fails.</span><span lang="EN-US" style="font-size:12pt"></span></font></p>


<p class="MsoNormal" style="margin:0cm 0cm 0pt;line-height:normal"><font face="arial,helvetica,sans-serif"><span lang="EN-US" style="font-size:10pt"> </span><span lang="EN-US" style="font-size:12pt"></span></font></p>

<p class="MsoNormal" style="margin:0cm 0cm 0pt;line-height:normal"><font face="arial,helvetica,sans-serif"><span lang="EN-US" style="font-size:10pt">This is part of the code I am using now.</span><span lang="EN-US" style="font-size:12pt"></span></font></p>


<p class="MsoNormal" style="margin:0cm 0cm 0pt;line-height:normal"><font face="arial,helvetica,sans-serif"><span lang="EN-US" style="font-size:10pt;color:blue"> </span><span lang="EN-US" style="font-size:12pt"></span></font></p>


<p class="MsoNormal" style="margin:0cm 0cm 0pt;line-height:normal"><font face="arial,helvetica,sans-serif"><span lang="EN-US" style="font-size:10pt">      <span style="color:green">//setup ICP transform</span></span><span lang="EN-US" style="font-size:12pt"></span></font></p>


<p class="MsoNormal" style="margin:0cm 0cm 0pt;line-height:normal"><font face="arial,helvetica,sans-serif"><span lang="EN-US" style="font-size:10pt">      icp = vtkSmartPointer&lt;vtkIterativeClosestPointTransform&gt;::New();</span><span lang="EN-US" style="font-size:12pt"></span></font></p>


<p class="MsoNormal" style="margin:0cm 0cm 0pt;line-height:normal"><font face="arial,helvetica,sans-serif"><span lang="EN-US" style="font-size:10pt">      icp-&gt;SetSource(newPolydata);   <span style="color:green">// newPolydata</span></span><span lang="EN-US" style="font-size:12pt"></span></font></p>


<p class="MsoNormal" style="margin:0cm 0cm 0pt;line-height:normal"><font face="arial,helvetica,sans-serif"><span lang="EN-US" style="font-size:10pt">      icp-&gt;SetTarget(referencePolydata);   <span style="color:green">//  referencePolydata</span></span><span lang="EN-US" style="font-size:12pt"></span></font></p>


<p class="MsoNormal" style="margin:0cm 0cm 0pt;line-height:normal"><font face="arial,helvetica,sans-serif"><span lang="EN-US" style="font-size:10pt">      icp-&gt;GetLandmarkTransform()-&gt;SetModeToRigidBody();</span><span lang="EN-US" style="font-size:12pt"></span></font></p>


<p class="MsoNormal" style="margin:0cm 0cm 0pt;line-height:normal"><font face="arial,helvetica,sans-serif"><span lang="EN-US" style="font-size:10pt">      icp-&gt;SetMaximumNumberOfLandmarks((<span style="color:blue">int</span>)ceil(newPolydata-&gt; GetNumberOfPoints()*0.9));</span><span lang="EN-US" style="font-size:12pt"></span></font></p>


<p class="MsoNormal" style="margin:0cm 0cm 0pt;line-height:normal"><font face="arial,helvetica,sans-serif"><span lang="EN-US" style="font-size:10pt"> </span><span lang="EN-US" style="font-size:12pt"></span></font></p>

<p class="MsoNormal" style="margin:0cm 0cm 0pt;line-height:normal"><font face="arial,helvetica,sans-serif"><span lang="EN-US" style="font-size:10pt">      icp-&gt;SetMaximumNumberOfIterations(100);</span><span lang="EN-US" style="font-size:12pt"></span></font></p>


<p class="MsoNormal" style="margin:0cm 0cm 0pt;line-height:normal"><font face="arial,helvetica,sans-serif"><span lang="EN-US" style="font-size:10pt">      icp-&gt;SetCheckMeanDistance(1);</span><span lang="EN-US" style="font-size:12pt"></span></font></p>


<p class="MsoNormal" style="margin:0cm 0cm 0pt;line-height:normal"><font face="arial,helvetica,sans-serif"><span lang="EN-US" style="font-size:10pt">      icp-&gt;SetMaximumMeanDistance(0.001);</span><span lang="EN-US" style="font-size:12pt"></span></font></p>


<p class="MsoNormal" style="margin:0cm 0cm 0pt;line-height:normal"><font face="arial,helvetica,sans-serif"><span lang="EN-US" style="font-size:10pt">      icp-&gt;StartByMatchingCentroidsOn();</span><span style="font-size:12pt"></span></font></p>


<p class="MsoNormal" style="margin:0cm 0cm 0pt;line-height:normal"><font face="arial,helvetica,sans-serif"><span lang="EN-US" style="font-size:10pt"></span><span style="font-size:12pt"></span></font></p>

<p class="MsoNormal" style="margin:0cm 0cm 0pt;line-height:normal"><font face="arial,helvetica,sans-serif"><span lang="EN-US" style="font-size:10pt"> </span><span style="font-size:12pt"></span></font></p>

<p class="MsoNormal" style="margin:0cm 0cm 0pt;line-height:normal"><font face="arial,helvetica,sans-serif"><span lang="EN-US" style="font-size:10pt">      icp-&gt;Modified();</span><span lang="EN-US" style="font-size:12pt"></span></font></p>


<p class="MsoNormal" style="margin:0cm 0cm 0pt;line-height:normal"><font face="arial,helvetica,sans-serif"><span lang="EN-US" style="font-size:10pt">      icp-&gt;Update();</span><span lang="EN-US" style="font-size:12pt"></span></font></p>


<p class="MsoNormal" style="margin:0cm 0cm 0pt;line-height:normal"><font face="arial,helvetica,sans-serif"><span lang="EN-US" style="font-size:10pt"> </span><span lang="EN-US" style="font-size:12pt"></span></font></p>

<p class="MsoNormal" style="margin:0cm 0cm 0pt;line-height:normal"><font face="arial,helvetica,sans-serif"><span lang="EN-US" style="font-size:10pt"></span><span lang="EN-US" style="font-size:12pt"></span></font></p>

<p class="MsoNormal" style="margin:0cm 0cm 0pt;line-height:normal"><font face="arial,helvetica,sans-serif"><span lang="EN-US" style="font-size:10pt">      vtkSmartPointer&lt;vtkMatrix4x4&gt; M = icp-&gt;GetMatrix();</span><span lang="EN-US" style="font-size:12pt"></span></font></p>


<p class="MsoNormal" style="margin:0cm 0cm 0pt;line-height:normal"><font face="arial,helvetica,sans-serif"><span lang="EN-US" style="font-size:10pt">      cout &lt;&lt; <span style="color:#a31515">&quot;The resulting matrix is: &quot;</span> &lt;&lt; *M &lt;&lt; cout;</span><span lang="EN-US" style="font-size:12pt"></span></font></p>


<p class="MsoNormal" style="margin:0cm 0cm 0pt;line-height:normal"><font face="arial,helvetica,sans-serif"><span lang="EN-US" style="font-size:10pt">      </span><span lang="EN-US" style="font-size:12pt"></span></font></p>


<p class="MsoNormal" style="margin:0cm 0cm 0pt;line-height:normal"><span lang="EN-US" style="font-size:10pt"><font face="arial,helvetica,sans-serif"></font></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0pt;line-height:normal"><span lang="EN-US" style="font-size:10pt"><font face="arial,helvetica,sans-serif">      vtkSmartPointer&lt;vtkTransformPolyDataFilter&gt; Transf = </font></span></p>


<p class="MsoNormal" style="margin:0cm 0cm 0pt;line-height:normal"><span lang="EN-US" style="font-size:10pt"><font face="arial,helvetica,sans-serif">      vtkSmartPointer&lt;vtkTransformPolyDataFilter&gt;::New();</font></span></p>


<p class="MsoNormal" style="margin:0cm 0cm 0pt;line-height:normal"><span lang="EN-US" style="font-size:10pt"><font face="arial,helvetica,sans-serif">      Transf-&gt;SetInput(newPolydata);</font></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0pt;line-height:normal"><span lang="EN-US" style="font-size:10pt"><font face="arial,helvetica,sans-serif">      Transf-&gt;SetTransform(icp);</font></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0pt;line-height:normal"><font face="arial,helvetica,sans-serif"><span lang="EN-US" style="font-size:10pt">      </span><span style="font-size:10pt">Transf-&gt;Update();</span></font></p>


<div class="MsoNormal" style="margin:0cm 0cm 0pt;line-height:normal"><span style="font-size:10pt"><font face="arial,helvetica,sans-serif"> </font></span></div>

<div class="MsoNormal" style="margin:0cm 0cm 0pt;line-height:normal"><span style="font-size:10pt"><font face="arial,helvetica,sans-serif"></font></span> </div>

<p class="MsoNormal" style="margin:0cm 0cm 0pt;line-height:normal"><span style="font-size:10pt"><font face="arial,helvetica,sans-serif">Thanks in advance</font></span></p>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Wesley D. Turner, Ph.D.<br>Kitware, Inc.<br>Technical Leader<br>28 Corporate Drive<br>Clifton Park, NY 12065-8662<br>Phone: 518-881-4920<br>
</div>