[vtkusers] Iterative closest point transform for point clouds - need some help

Sylvain Jaume sylvain.jaume at kitware.com
Mon Nov 7 17:25:17 EST 2005


Hi Vikas,

vtkIterativeClosestPointTransform gives a transform. You need to apply 
the resulting transform to your input dataset using 
vtkTransformPolyDataFilter. You don't need to use vtkDelaunay3D, nor to 
type cast your datasets.

Cheers,
Sylvain

Vikas Singh wrote:

>Hello!
>
>I am a newbie to VTK and need some help with ICPT. Been trying all
>sorts of things since today morning including the VTK User's guide and
>the online documentation but nothing has worked so far. Seems to me
>that the problem is simple for someone who knows VTK well.
>
>I am trying to randomly generate point clouds and align them (as a start).
>
>vtkPolyData* polydata_1 = vtkPolyData::New();
>vtkDelaunay3D* del_1    = vtkDelaunay3D::New();
>vtkPoints* cloud_1         = vtkPoints::New();
>
>static float mypoint_1[3];
>
>for (int i = 0; i < 50; i++)
>    {
>      mypoint_1[0] = drand48()*50;
>      mypoint_1[1] = drand48()*50;
>      mypoint_1[2] = drand48()*50;
>
>      cloud_1->InsertNextPoint(mypoint_1);
>    }
>
>  polydata_1->SetPoints(cloud_1);
>
>  int num_of_points_1 = polydata_1->GetPoints()->GetNumberOfPoints();
>  cout << "in all, num of points in cloud 1 is " << num_of_points_1 << endl;
>
>  del_1->SetInput((vtkPointSet*)polydata_1);
>  del_1->SetTolerance(0.01);
>  del_1->PrintSelf(std::cout,0);
>
>I repeat the same for cloud 2 - variable names end with "_2".
>
>
>Then I call ICPT as follows:
>
>vtkIterativeClosestPointTransform *_icpt =
>vtkIterativeClosestPointTransform::New();
>_icpt->GetLandmarkTransform()->SetModeToRigidBody();
>_icpt->StartByMatchingCentroidsOn();
>_icpt->SetMaximumNumberOfIterations(10);
>
>_icpt->SetSource((vtkDataSet *)del_1->GetOutput());
>cout << "Calling icpt" << endl;
>_icpt->SetTarget((vtkDataSet *)del_2->GetOutput());
>
>_icpt->Update();
>
>
>To this it gives me an error
>
>ERROR: In /usr/local/VTK/Hybrid/vtkIterativeClosestPointTransform.cxx, line 274
>vtkIterativeClosestPointTransform (0x80650e0): Can't execute with NULL or empty
>input
>
>I think that up until the delaunay triangulation, it is working ok - I
>rendered it and it is alright. If I do not do a delaunay triangulation
>and typecast cloud_1 and cloud_2 directly it never returns from ICPT.
>
>any pointers, please?
>
>VS.
>_______________________________________________
>This is the private VTK discussion list. 
>Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>Follow this link to subscribe/unsubscribe:
>http://www.vtk.org/mailman/listinfo/vtkusers
>
>  
>



More information about the vtkusers mailing list