<div><font face="arial,helvetica,sans-serif">Hi Wes,</font></div>
<div><font face="arial,helvetica,sans-serif"></font> </div>
<div><font face="arial,helvetica,sans-serif">Thanks for your help. I am using the transform determined at the previous stage as an initial transform on the currente stage. For example, I am registering the data set in 0 grades and 10 grades, then apply the transformation to the images at 10 grades and with a new point cloud (20 grades) I use the ICP algorithm again, that is, my sequence of registrations is 2 to 1, 3 to 2, 4 to 3, etc..</font></div>

<div> </div>
<div>I got a perfect alignment until 90 grades. I&#39;ve tried with many objects but I always have the same result, the alignment at 100 grades is erroneous...</div><br><br>
<div class="gmail_quote">On Fri, Jul 23, 2010 at 7:43 PM, Wes Turner <span dir="ltr">&lt;<a href="mailto:wes.turner@kitware.com">wes.turner@kitware.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">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">
<div>
<div></div>
<div class="h5">On Fri, Jul 23, 2010 at 7:21 PM, celeste gonzalez <span dir="ltr">&lt;<a href="mailto:celgon23@gmail.com" target="_blank">celgon23@gmail.com</a>&gt;</span> wrote:<br></div></div>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div>
<div></div>
<div class="h5">
<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></div></div>_______________________________________________<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></blockquote></div><br>