testing whether a point lies on a MLS surface

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

testing whether a point lies on a MLS surface

eyebies
Hi,
I'm trying to fit surface to a point cloud. I would like to now find out, given two new points, lie on the same side of the surface or not.
Say if S== 0 defines the surface, I need to find out,given a new point 'x',  whether S(x)>0 or S(x)<0.
Is there a way to find it out using the existing MLS class.
Pls let me know.
thanks
Phani
Reply | Threaded
Open this post in threaded view
|

Re: testing whether a point lies on a MLS surface

aichim
Administrator
Hi,


MLS could help you with that, but more as a pre-processing step for smoothing your cloud.
Unfortunately, I am not aware of any method that does specifically in PCL.

One way I would do it is to mesh your point cloud (via Poisson, Convex/ConcaveHull), then convert the PolygonMesh structure you will get to vtkPolyData (http://docs.pointclouds.org/trunk/classpcl_1_1_v_t_k_utils.html#ade6c1e5b8f57b8bdb74af9ec77dd7cc4), and while inside the VTK realm follow this tutorial (http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/PointInsideObject).
What that class does is shoot a random ray from your query point and check how many times the ray intersects the mesh (if the number is odd, you are inside, if it is even, then you are outside). I am not exactly sure how it is implemented in VTK, but this method might be slow if you have many triangles.

Hope this helps.


Cheers,
Alex



On Oct 15, 2012, at 8:16 AM, eyebies <[hidden email]> wrote:

> Hi,
> I'm trying to fit surface to a point cloud. I would like to now find out,
> given two new points, lie on the same side of the surface or not.
> Say if S== 0 defines the surface, I need to find out,given a new point 'x',
> whether S(x)>0 or S(x)<0.
> Is there a way to find it out using the existing MLS class.
> Pls let me know.
> thanks
> Phani
>
>
>
>
> --
> View this message in context: http://www.pcl-users.org/testing-whether-a-point-lies-on-a-MLS-surface-tp4023006.html
> Sent from the Point Cloud Library (PCL) Users mailing list mailing list archive at Nabble.com.
> _______________________________________________
> [hidden email] / http://pointclouds.org
> http://pointclouds.org/mailman/listinfo/pcl-users

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: testing whether a point lies on a MLS surface

Pat Marion
I see in the implementation of vtkSelectEnclosedPoints::IsInsideSurface() that it uses vtkCellLocator::FindCellsAlongLine(). The vtkCellLocator uses an octree based spatial search, so hopefully it will scale OK with the resolution of your mesh.

Pat

On Mon, Oct 15, 2012 at 1:28 PM, Alexandru Ichim <[hidden email]> wrote:
Hi,


MLS could help you with that, but more as a pre-processing step for smoothing your cloud.
Unfortunately, I am not aware of any method that does specifically in PCL.

One way I would do it is to mesh your point cloud (via Poisson, Convex/ConcaveHull), then convert the PolygonMesh structure you will get to vtkPolyData (http://docs.pointclouds.org/trunk/classpcl_1_1_v_t_k_utils.html#ade6c1e5b8f57b8bdb74af9ec77dd7cc4), and while inside the VTK realm follow this tutorial (http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/PointInsideObject).
What that class does is shoot a random ray from your query point and check how many times the ray intersects the mesh (if the number is odd, you are inside, if it is even, then you are outside). I am not exactly sure how it is implemented in VTK, but this method might be slow if you have many triangles.

Hope this helps.


Cheers,
Alex



On Oct 15, 2012, at 8:16 AM, eyebies <[hidden email]> wrote:

> Hi,
> I'm trying to fit surface to a point cloud. I would like to now find out,
> given two new points, lie on the same side of the surface or not.
> Say if S== 0 defines the surface, I need to find out,given a new point 'x',
> whether S(x)>0 or S(x)<0.
> Is there a way to find it out using the existing MLS class.
> Pls let me know.
> thanks
> Phani
>
>
>
>
> --
> View this message in context: http://www.pcl-users.org/testing-whether-a-point-lies-on-a-MLS-surface-tp4023006.html
> Sent from the Point Cloud Library (PCL) Users mailing list mailing list archive at Nabble.com.
> _______________________________________________
> [hidden email] / http://pointclouds.org
> http://pointclouds.org/mailman/listinfo/pcl-users

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users


_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: testing whether a point lies on a MLS surface

aichim
Administrator
Oh, even better, thanks Pat! I did not check the source code :-)

Cheers,
Alex


On Oct 15, 2012, at 2:42 PM, Pat Marion <[hidden email]> wrote:

I see in the implementation of vtkSelectEnclosedPoints::IsInsideSurface() that it uses vtkCellLocator::FindCellsAlongLine(). The vtkCellLocator uses an octree based spatial search, so hopefully it will scale OK with the resolution of your mesh.

Pat

On Mon, Oct 15, 2012 at 1:28 PM, Alexandru Ichim <[hidden email]> wrote:
Hi,


MLS could help you with that, but more as a pre-processing step for smoothing your cloud.
Unfortunately, I am not aware of any method that does specifically in PCL.

One way I would do it is to mesh your point cloud (via Poisson, Convex/ConcaveHull), then convert the PolygonMesh structure you will get to vtkPolyData (http://docs.pointclouds.org/trunk/classpcl_1_1_v_t_k_utils.html#ade6c1e5b8f57b8bdb74af9ec77dd7cc4), and while inside the VTK realm follow this tutorial (http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/PointInsideObject).
What that class does is shoot a random ray from your query point and check how many times the ray intersects the mesh (if the number is odd, you are inside, if it is even, then you are outside). I am not exactly sure how it is implemented in VTK, but this method might be slow if you have many triangles.

Hope this helps.


Cheers,
Alex



On Oct 15, 2012, at 8:16 AM, eyebies <[hidden email]> wrote:

> Hi,
> I'm trying to fit surface to a point cloud. I would like to now find out,
> given two new points, lie on the same side of the surface or not.
> Say if S== 0 defines the surface, I need to find out,given a new point 'x',
> whether S(x)>0 or S(x)<0.
> Is there a way to find it out using the existing MLS class.
> Pls let me know.
> thanks
> Phani
>
>
>
>
> --
> View this message in context: http://www.pcl-users.org/testing-whether-a-point-lies-on-a-MLS-surface-tp4023006.html
> Sent from the Point Cloud Library (PCL) Users mailing list mailing list archive at Nabble.com.
> _______________________________________________
> [hidden email] / http://pointclouds.org
> http://pointclouds.org/mailman/listinfo/pcl-users

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users


_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: testing whether a point lies on a MLS surface

eyebies
Thanks for the help, guys! I really appreciate it. This may be naive question but can we not analytically calculate it from the parameters derived for the surface (mls_results)? 

On Tue, Oct 16, 2012 at 3:15 AM, Alexandru Ichim <[hidden email]> wrote:
Oh, even better, thanks Pat! I did not check the source code :-)

Cheers,
Alex


On Oct 15, 2012, at 2:42 PM, Pat Marion <[hidden email]> wrote:

I see in the implementation of vtkSelectEnclosedPoints::IsInsideSurface() that it uses vtkCellLocator::FindCellsAlongLine(). The vtkCellLocator uses an octree based spatial search, so hopefully it will scale OK with the resolution of your mesh.

Pat

On Mon, Oct 15, 2012 at 1:28 PM, Alexandru Ichim <[hidden email]> wrote:
Hi,


MLS could help you with that, but more as a pre-processing step for smoothing your cloud.
Unfortunately, I am not aware of any method that does specifically in PCL.

One way I would do it is to mesh your point cloud (via Poisson, Convex/ConcaveHull), then convert the PolygonMesh structure you will get to vtkPolyData (http://docs.pointclouds.org/trunk/classpcl_1_1_v_t_k_utils.html#ade6c1e5b8f57b8bdb74af9ec77dd7cc4), and while inside the VTK realm follow this tutorial (http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/PointInsideObject).
What that class does is shoot a random ray from your query point and check how many times the ray intersects the mesh (if the number is odd, you are inside, if it is even, then you are outside). I am not exactly sure how it is implemented in VTK, but this method might be slow if you have many triangles.

Hope this helps.


Cheers,
Alex



On Oct 15, 2012, at 8:16 AM, eyebies <[hidden email]> wrote:

> Hi,
> I'm trying to fit surface to a point cloud. I would like to now find out,
> given two new points, lie on the same side of the surface or not.
> Say if S== 0 defines the surface, I need to find out,given a new point 'x',
> whether S(x)>0 or S(x)<0.
> Is there a way to find it out using the existing MLS class.
> Pls let me know.
> thanks
> Phani
>
>
>
>
> --
> View this message in context: http://www.pcl-users.org/testing-whether-a-point-lies-on-a-MLS-surface-tp4023006.html
> Sent from the Point Cloud Library (PCL) Users mailing list mailing list archive at Nabble.com.
> _______________________________________________
> [hidden email] / http://pointclouds.org
> http://pointclouds.org/mailman/listinfo/pcl-users

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users


_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users



_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: testing whether a point lies on a MLS surface

aichim
Administrator
Hi,


You are welcome!

Yes, I wanted to avoid that option, since we do not have all the things you need yet implemented in PCL. 

What you could do is to compute the normals for your input cloud and _make sure_ their directions are correct (the problem here is that our NormalEstimation class does not propagate the normal directions along the point cloud yet, so you still have a sign uncertainty for your normals). Then, for each query point you find its closest neighbor on the input cloud and check if the normal is pointing towards it or not (this assumes that your input cloud does not have any special things such as thin surfaces).

I think that if vtkSelectEnclosedPoints is implemented nicely (which most probably is), you will get similar runtimes for both approaches.


Cheers,
Alex

On Oct 16, 2012, at 8:13 AM, Phani Ivatury <[hidden email]> wrote:

Thanks for the help, guys! I really appreciate it. This may be naive question but can we not analytically calculate it from the parameters derived for the surface (mls_results)? 

On Tue, Oct 16, 2012 at 3:15 AM, Alexandru Ichim <[hidden email]> wrote:
Oh, even better, thanks Pat! I did not check the source code :-)

Cheers,
Alex


On Oct 15, 2012, at 2:42 PM, Pat Marion <[hidden email]> wrote:

I see in the implementation of vtkSelectEnclosedPoints::IsInsideSurface() that it uses vtkCellLocator::FindCellsAlongLine(). The vtkCellLocator uses an octree based spatial search, so hopefully it will scale OK with the resolution of your mesh.

Pat

On Mon, Oct 15, 2012 at 1:28 PM, Alexandru Ichim <[hidden email]> wrote:
Hi,


MLS could help you with that, but more as a pre-processing step for smoothing your cloud.
Unfortunately, I am not aware of any method that does specifically in PCL.

One way I would do it is to mesh your point cloud (via Poisson, Convex/ConcaveHull), then convert the PolygonMesh structure you will get to vtkPolyData (http://docs.pointclouds.org/trunk/classpcl_1_1_v_t_k_utils.html#ade6c1e5b8f57b8bdb74af9ec77dd7cc4), and while inside the VTK realm follow this tutorial (http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/PointInsideObject).
What that class does is shoot a random ray from your query point and check how many times the ray intersects the mesh (if the number is odd, you are inside, if it is even, then you are outside). I am not exactly sure how it is implemented in VTK, but this method might be slow if you have many triangles.

Hope this helps.


Cheers,
Alex



On Oct 15, 2012, at 8:16 AM, eyebies <[hidden email]> wrote:

> Hi,
> I'm trying to fit surface to a point cloud. I would like to now find out,
> given two new points, lie on the same side of the surface or not.
> Say if S== 0 defines the surface, I need to find out,given a new point 'x',
> whether S(x)>0 or S(x)<0.
> Is there a way to find it out using the existing MLS class.
> Pls let me know.
> thanks
> Phani
>
>
>
>
> --
> View this message in context: http://www.pcl-users.org/testing-whether-a-point-lies-on-a-MLS-surface-tp4023006.html
> Sent from the Point Cloud Library (PCL) Users mailing list mailing list archive at Nabble.com.
> _______________________________________________
> [hidden email] / http://pointclouds.org
> http://pointclouds.org/mailman/listinfo/pcl-users

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users


_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users


_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users


_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: testing whether a point lies on a MLS surface

eyebies
I will go with VTK then. thanks again!
~p

On Tue, Oct 16, 2012 at 10:07 PM, Alexandru Ichim <[hidden email]> wrote:
Hi,


You are welcome!

Yes, I wanted to avoid that option, since we do not have all the things you need yet implemented in PCL. 

What you could do is to compute the normals for your input cloud and _make sure_ their directions are correct (the problem here is that our NormalEstimation class does not propagate the normal directions along the point cloud yet, so you still have a sign uncertainty for your normals). Then, for each query point you find its closest neighbor on the input cloud and check if the normal is pointing towards it or not (this assumes that your input cloud does not have any special things such as thin surfaces).

I think that if vtkSelectEnclosedPoints is implemented nicely (which most probably is), you will get similar runtimes for both approaches.


Cheers,
Alex

On Oct 16, 2012, at 8:13 AM, Phani Ivatury <[hidden email]> wrote:

Thanks for the help, guys! I really appreciate it. This may be naive question but can we not analytically calculate it from the parameters derived for the surface (mls_results)? 

On Tue, Oct 16, 2012 at 3:15 AM, Alexandru Ichim <[hidden email]> wrote:
Oh, even better, thanks Pat! I did not check the source code :-)

Cheers,
Alex


On Oct 15, 2012, at 2:42 PM, Pat Marion <[hidden email]> wrote:

I see in the implementation of vtkSelectEnclosedPoints::IsInsideSurface() that it uses vtkCellLocator::FindCellsAlongLine(). The vtkCellLocator uses an octree based spatial search, so hopefully it will scale OK with the resolution of your mesh.

Pat

On Mon, Oct 15, 2012 at 1:28 PM, Alexandru Ichim <[hidden email]> wrote:
Hi,


MLS could help you with that, but more as a pre-processing step for smoothing your cloud.
Unfortunately, I am not aware of any method that does specifically in PCL.

One way I would do it is to mesh your point cloud (via Poisson, Convex/ConcaveHull), then convert the PolygonMesh structure you will get to vtkPolyData (http://docs.pointclouds.org/trunk/classpcl_1_1_v_t_k_utils.html#ade6c1e5b8f57b8bdb74af9ec77dd7cc4), and while inside the VTK realm follow this tutorial (http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/PointInsideObject).
What that class does is shoot a random ray from your query point and check how many times the ray intersects the mesh (if the number is odd, you are inside, if it is even, then you are outside). I am not exactly sure how it is implemented in VTK, but this method might be slow if you have many triangles.

Hope this helps.


Cheers,
Alex



On Oct 15, 2012, at 8:16 AM, eyebies <[hidden email]> wrote:

> Hi,
> I'm trying to fit surface to a point cloud. I would like to now find out,
> given two new points, lie on the same side of the surface or not.
> Say if S== 0 defines the surface, I need to find out,given a new point 'x',
> whether S(x)>0 or S(x)<0.
> Is there a way to find it out using the existing MLS class.
> Pls let me know.
> thanks
> Phani
>
>
>
>
> --
> View this message in context: http://www.pcl-users.org/testing-whether-a-point-lies-on-a-MLS-surface-tp4023006.html
> Sent from the Point Cloud Library (PCL) Users mailing list mailing list archive at Nabble.com.
> _______________________________________________
> [hidden email] / http://pointclouds.org
> http://pointclouds.org/mailman/listinfo/pcl-users

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users


_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users


_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users


_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users



_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users