[vtkusers] Nearest Pixel to a point

Matias Montroull matimontg at gmail.com
Tue Mar 11 20:11:35 EDT 2014


I've used vtkKdTree:

                vtkPolyData polydata = new vtkPolyData();
                polydata.SetPoints(yourpoints3D);

                vtkKdTree kdtree = new vtkKdTree();
                kdtree.SetDataSet(polydata);
                kdtree.BuildLocatorFromPoints(yourpoints3D);

Then somewhere in your code:

                    double dist_minima = 0;
                    var indice = kdtree.FindClosestPoint(x, y, z, ref
dist_minima); //where x, y and z are your 2D image points..
                    var closestpoint = kdtree.GetDataSet().GetPoint(indice);


On Tue, Mar 11, 2014 at 8:59 PM, Fabian Torres <fabian.trobles at gmail.com>wrote:

> Hi all
>
> I have a cloud of points in a 3D space (pointCloud). I also have a 2D
> image (I know the rotation and translation of this image for the 3D space).
>
> Is there a way I can find the nearest pixel of the vtkImage to a point in
> pointCloud?
>
> --
> Fabián Torres Robles
> Maestria en Ciencias en Ingeniería Electrónica
> Ingeniería en Sistemas Electrónicos
> tel. 58081280, 0445534661338
> e-mail fabian.trobles at gmail.com, dae.wong at gmail.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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20140311/08feee09/attachment.html>


More information about the vtkusers mailing list