[vtkusers] Iterative Closest Point Transform - problem

Bill Lorensen bill.lorensen at gmail.com
Sun Apr 14 11:14:51 EDT 2013


Before the icp, can you:
target->Print(std:;cout);
and post the results




On Sun, Apr 14, 2013 at 11:00 AM, z.adva <adva.zair at mail.huji.ac.il> wrote:

> Hi,
>
> I'm trying to perform registration on two PolyData objects, but the
> resulting transformation is far from  being the solution.
> I used the code from
>
> http://www.vtk.org/Wiki/VTK/Examples/Cxx/Filtering/IterativeClosestPointsTransform
> without much changes.
>
> For debug, I simply ran the ICP with source=target and expected to get the
> identity matrix, but I got different matrix, and the transformation was
> bad.
>
> When the ICP's debug-flag was on, it said that after about 29 iterations
> the
> mean-distance was
> very small (~10^-6), although when I viewed the solution it seems not close
> at all.
>
> I started with fractured bone-object and then extracted its
> fracture-surface
> in order to match the two surfaces. When I ran the ICP on one of the
> original bones it worked well ( the output was the identity matrix ) so the
> odd behavior is only at the extracted PolyData.
>
> my code:
>
>     // Setup ICP transform
>     vtkSmartPointer<vtkIterativeClosestPointTransform> icp =
>         vtkSmartPointer<vtkIterativeClosestPointTransform>::New();
>     icp->SetSource(target);
>     icp->SetTarget(target);
>     //icp->DebugOn();
>     //icp->StartByMatchingCentroidsOn();
>     icp->SetMaximumNumberOfIterations(29);
>     icp->SetMaximumNumberOfLandmarks(target->GetNumberOfPoints());
>     icp->SetCheckMeanDistance(1);
>     icp->SetMaximumMeanDistance(0.0000001);
>     icp->GetLandmarkTransform()->SetModeToRigidBody();
>     icp->Modified();
>     icp->Update();
>
>
>     // Get the resulting transformation matrix (this matrix takes the
> source
> points to the target points)
>     vtkSmartPointer<vtkMatrix4x4> m = icp->GetMatrix();
>     std::cout << "The resulting matrix is: " << *m << std::endl;
>
>
>
>     // Transform the source points by the ICP solution
>     vtkSmartPointer<vtkTransformPolyDataFilter> icpTransformFilter =
>         vtkSmartPointer<vtkTransformPolyDataFilter>::New();
> #if VTK_MAJOR_VERSION <= 5
>     icpTransformFilter->SetInput(target);
> #else
>     icpTransformFilter->SetInputData(target);
> #endif
>     icpTransformFilter->SetTransform( icp );
>     icpTransformFilter->Update();
>
>     /*
>     // If you need to take the target points to the source points, the
> matrix is:
>     icp->Inverse();
>     vtkSmartPointer<vtkMatrix4x4> minv = icp->GetMatrix();
>     std::cout << "The resulting inverse matrix is: " << *minv << std::cout;
>     */
>     vtkSmartPointer<vtkPolyData> output =
> vtkSmartPointer<vtkPolyData>::New();
>     output = icpTransformFilter->GetOutput();
>     vtkSmartPointer<vtkPolyDataWriter> writer =
> vtkSmartPointer<vtkPolyDataWriter>::New();
>     writer->SetFileName( fileName );
>     writer->SetInput( output );
>     writer->Update();
>
>
> One more worth mentioned remark is that in the process of extracting the
> surface I get in the pipeline
> vtkUnstructuredGrid object that I later convert to PolyData..
>
> any thoughts?
>
> Thank you,
> Adva
>
>
>
> --
> View this message in context:
> http://vtk.1045678.n5.nabble.com/Iterative-Closest-Point-Transform-problem-tp5720040.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



-- 
Unpaid intern in BillsBasement at noware dot com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130414/4c65e741/attachment.htm>


More information about the vtkusers mailing list