[vtkusers] ICP not working well

David Doria daviddoria at gmail.com
Mon Mar 23 09:52:25 EDT 2009

Wes - you were right on, I switched which file was the target and it worked
much better. I guess I thought the implementation would have thrown away
points that didn't have a "good" match, but maybe it is and that threshold
is just larger than expected? Is that modifiable?

Also, I am apparently doing something wrong with the inverse transform.
This works correctly, and brings the Scan to the Model:
    vtkTransformPolyDataFilter* ScanToModel =
    vtkPolyData* polydataScan = ScanToModel->GetOutput();

So I thought this would bring the Model to the Scan:

    vtkTransformPolyDataFilter* ModelToScan =
    vtkLinearTransform* inv = icp->GetLinearInverse();
    vtkPolyData* polydataModel = ModelToScan->GetOutput();

but it ends up in a really wacky position. Is there more to it than simply
calling GetLinearInverse?



On Mon, Mar 23, 2009 at 9:13 AM, Wes Turner <wes.turner at kitware.com> wrote:

> My apologies ... as always haste makes waste.  I edited what I wrote to
> make it (slightly) more readable.
> On Mon, Mar 23, 2009 at 9:05 AM, Wes Turner <wes.turner at kitware.com>wrote:
>> David,
>> I just took a quick look, so you probably need to do some analysis on your
>> own to fully resolve this issue.  Looking at the data sets, it appears that
>> you are sampling Bunny.vtp (source) and using it to sample points from
>> BunnyScan.vtp (target) using ICP.  Since BunnyScan only contains the front
>> side of Bunny, any points sampled from the rear surface of Bunny will not
>> find a true match and will end up pulling BunnyScan away from the front
>> surface and more toward the center of Bunny.  This is consistent with the
>> data you are showing.
>> You might be able to get what you are looking for simply by swapping the
>> source and target in the ICP and using that as the transform to apply to
>> BunnyScan, moving it towards Bunny.  If you need the inverse transform
>> (moving Bunny towards BunnyScan) you will need to explicitly calculate the
>> inverse transform by grabbing the Matrix4x4 from the ICP on completion,
>> inverting it, and applying it as the transform to Bunny.  Directly inverting
>> the icp will not work as it just swaps source and target which will get you
>> right back to your current state.
>> All of this is from memory, so your mileage may vary.
>> - Wes
>> On Sat, Mar 21, 2009 at 11:48 AM, David Doria <daviddoria at gmail.com>wrote:
>>> Here are my input files / output file:
>>> http://www.rpi.edu/~doriad/Bunny/ <http://www.rpi.edu/%7Edoriad/Bunny/>
>>> I am trying to register Bunny.vtp to BunnyScan.vtp and the result is in
>>> MatchedBunny.vtp
>>> Here are my settings:
>>>     vtkIterativeClosestPointTransform * icp =
>>> vtkIterativeClosestPointTransform::New();
>>>     icp->SetMaximumNumberOfIterations(1000);
>>>     icp->SetMaximumMeanDistance(1e-6);
>>>     icp->GetLandmarkTransform()->SetModeToRigidBody();
>>> I believe I am calling everything correctly because the resulting point
>>> cloud is much nearer than the original. However it seems to still be
>>> significantly wrong. Anyone know why this would be?
>>> Thanks,
>>> David
>>> _______________________________________________
>>> 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.
>> R&D Engineer
>> 28 Corporate Drive
>> Clifton Park, NY 12065-8662
>> Phone: 518-371-3971 x120
> --
> Wesley D. Turner, Ph.D.
> Kitware, Inc.
> R&D Engineer
> 28 Corporate Drive
> Clifton Park, NY 12065-8662
> Phone: 518-371-3971 x120
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20090323/bce5925f/attachment.htm>

More information about the vtkusers mailing list