PointCloudLibrary / pcl

Point Cloud Library (PCL)
https://pointclouds.org/
Other
9.91k stars 4.61k forks source link

Does the normal direct outside of the object? in MLS. #4502

Closed THHHomas closed 3 years ago

THHHomas commented 3 years ago

When calculating the normal via moving least square, does the normal direct outside of the object? I guess the normal of MLS reference plane can only decide the line where the normal lie, but cannot decide the direction of the normal.

guyuezuntinggithub commented 3 years ago

yes, it doesn't. you should try adjusting the normal consist.there is no API can do these in pcl

kunaltyagi commented 3 years ago

The direction is pretty much arbitrary for the normal since PCL considers surfaces to be thin which don't have an "inside" or "outside". Only when you construct a non-thin surface can you specify the inside or outside on the 2 sides of the new thick surface

I'm closing the issue (since I feel there's not a lot PCL can help wrt the question posed), but please feel free to reopen or continue the discussion

THHHomas commented 3 years ago

@guyuezuntinggithub Thanks a lot. Do you know any method to adjust the normal consist fast?

mvieth commented 3 years ago

@THHHomas You could have a look at NormalEstimation, where after the computation the normals are flipped towards the viewpoint: https://github.com/PointCloudLibrary/pcl/blob/f9c2c7bf51461d77dbc26727938fba30512e5b4f/features/include/pcl/features/impl/normal_3d.hpp#L71 https://github.com/PointCloudLibrary/pcl/blob/f9c2c7bf51461d77dbc26727938fba30512e5b4f/features/include/pcl/features/normal_3d.h#L122 There is also the function flipNormalTowardsNormalsMean.

THHHomas commented 3 years ago

@mvieth Thanks a lot. Even if it is towards the viewpoint, it may not direct to the outside of the object. I need a method that can flip the normal to the outside of the object.

mvieth commented 3 years ago

I am not aware of such a method. How would the algorithm even determine where "outside" and where "inside" is? It is also worth to mention that most if not all functions in PCL that deal with normals work the same whether the normals are "flipped" in the opposite direction or not, if that is your concern.