[vtkusers] How to bring an object to the coordinate's origin

Wes Turner wes.turner at kitware.com
Fri Mar 25 08:39:14 EDT 2011


On Fri, Mar 25, 2011 at 8:20 AM, nuno.jf <nunofernandes7 at gmail.com> wrote:

> Wes,
>
> Thank you very much for your answer, but unfortunately I don't know how to
> do what you suggested me.
> How do I turn off ICP initialization, or chose the partial clouds as the
> source points?
> Is this it? -> icp -> StartByMatchingCentroidsOff();
>

Yes.



>
> Is there any example for me to see? Sorry for all of this questions, I am
> still a newbie in this field.
> This is how my code:
>
>        // Rigid Transform
>        //---------------------------------------------------------
>        vtkTransformPolyDataFilter *TF = vtkTransformPolyDataFilter::New();
>        vtkTransform *ActualPosition = vtkTransform::New();
>
>        int n;
>        n= 5* 7* (360/290);
>        ActualPosition -> Identity();
>        ActualPosition -> PostMultiply();
>        ActualPosition -> Translate( 0, 0, -875);
>        ActualPosition -> RotateY(n );
>        ActualPosition -> Translate( 0, 0,  875);
>
>        TF -> SetInput( polyData2 );
>        TF -> SetTransform( ActualPosition );
>        TF -> Update();
>
>
>        // ICP
>        //---------------------------------------------------------
>
>        vtkIterativeClosestPointTransform * icp =
> vtkIterativeClosestPointTransform::New();
>
>        // Set SOURCE and TARGET points
>
>        icp -> SetTarget( polyData1 );
>

I believe this data can include points outside the region of overlap
provided that the initial registration is close

       icp -> SetSource( TF ->GetOutput() );
>

This data needs to be only the overlap region.  If it is a subset of the
target, you should be good.  Otherwise, use your good initial guess to put
it close, then use the bounding box of the Target to set up a clip function
that removes points outside the region of overlap. There are other methods,
but essentially you need to find a way to only use points within Source that
have valid associations to Target ... Which way you choose is problem
dependent.

- Wes


>
>        // Configure ICP transform
>        //---------------------------------------------------------
>
>        icp -> SetMaximumNumberOfIterations( 100 );
>        icp -> SetMaximumNumberOfLandmarks( 10000 );
>        icp -> StartByMatchingCentroidsOff();
>        icp -> GetLandmarkTransform()->SetModeToRigidBody();
>        icp -> SetMeanDistanceModeToRMS();
>        icp -> SetMaximumMeanDistance(0.000001);
>        icp -> Update();
>
>        std::cout << "ICP Mean Distance RMS = " << icp -> GetMeanDistance()
> <<
> std::endl;
>
>        // transform SOURCE to obtain TARGET
>        //---------------------------------------------------------
>        vtkTransformPolyDataFilter * transform =
> vtkTransformPolyDataFilter::New();
>
>        transform -> SetTransform( icp );
>        transform -> SetInput( TF->GetOutput());
>        transform -> Update();
>
>
>        std::cout << "ICP transform done." << std::endl;
>
> Could you indicate my, by seeing this, what should I do?
>
> --
> View this message in context:
> http://vtk.1045678.n5.nabble.com/How-to-bring-an-object-to-the-coordinate-s-origin-tp4243261p4263986.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
>



-- 
Wesley D. Turner, Ph.D.
Kitware, Inc.
Technical Leader
28 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-881-4920
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110325/eb409e76/attachment.htm>


More information about the vtkusers mailing list