Hi all,<br><br>I've looked into the archive but still can't get vtkIterativeClosestPointTransform working. I only wish to align two point clouds, and print out the 6-degree-of-freedom result in any form. Would anyone come up with a hello-world level solution (in c++), or correct my code?
<br><br>Thanks and Thanks and Thanks!<br><br>Arnie<br><br>My testing program follows.....<br><br>////////////////////////////////////<br>#include <vtk/vtkPoints.h><br>#include <vtk/vtkPolyData.h><br>#include <vtk/vtkDataSet.h>
<br>#include <vtk/vtkLandmarkTransform.h><br>#include <vtk/vtkIterativeClosestPointTransform.h><br><br>using namespace std;<br>//make_icp by Benedikt<br>vtkIterativeClosestPointTransform * make_icp(vtkDataSet * source, vtkDataSet *
<br>target, int iter)<br>{<br> vtkIterativeClosestPointTransform * icp =<br> vtkIterativeClosestPointTransform::New();<br> icp->SetSource(source);<br> icp->SetTarget(target);<br> // icp->DebugOn();
<br> icp->SetMaximumNumberOfIterations(iter);<br> icp->SetMaximumNumberOfLandmarks(source->GetNumberOfPoints());<br> icp->SetCheckMeanDistance(1);<br> icp->SetMaximumMeanDistance(
0.0000001);<br> icp->GetLandmarkTransform()->SetModeToRigidBody();<br> icp->Modified();<br> icp->Update();<br> return icp;<br>};<br><br>int main(){<br> float x[8][3]={{0,0,0}, {1,0,0}, {1,1,0}, {0,1,0},
<br> {0,0,1}, {1,0,1}, {1,1,1}, {0,1,1}};<br> vtkPoints *points1 = vtkPoints::New();<br> vtkPolyData *cube1 = vtkPolyData::New();<br> vtkPoints *points2 = vtkPoints::New();<br> vtkPolyData *cube2 = vtkPolyData::New();
<br> for (int i=0; i<8; i++) points1->InsertPoint(i,x[i]);<br> for (int i=0; i<8; i++) points2->InsertPoint(i,x[i]);<br> cube1->SetPoints(points1);<br> cube2->SetPoints(points2);<br><br> vtkIterativeClosestPointTransform *icp = make_icp( cube1, cube2, 100 );
<br> icp ->PrintSelf(std::cout,0);<br><br> points1->Delete();<br> points2->Delete();<br>}<br><br>//////////END OF CODE///////////<br><br><br><br><br>