-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add OpenMP to radius outlier removal #6182
Add OpenMP to radius outlier removal #6182
Conversation
… overwritten by the value of the input cloud.
@alexeygritsenko if you can test this on your point cloud it would be nice. |
On the test clouds, with 387 points and about 300.000 points (measured together in the test) I get something like this: It will also depend a lot on number of neighbors. |
@larshg, I use C++ at a primitive level (and I don't understand anything about compilation), unfortunately I won't be able to until it becomes available through the |
Adding multi-threading to the class is a nice idea. However I would not use |
Yes, I reasoned that as well. I'll try your suggestion 👍 |
c3caed5
to
91ae53b
Compare
Looks promising - down to about 20ms now with 6+ threads. But doesn't seem to improve from there. |
…removed in an array. Do a second loop, to assign indexes to indices and removed_indices_.
91ae53b
to
fc3af6a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly minor things ...
Looks promising - down to about 20ms now with 6+ threads. But doesn't seem to improve from there.
I could imagine that at some point, memory access is the limiting factor instead of computing power. Either way, 20ms is really good.
applyFilter (indices); | ||
pcl::copyPointCloud (*input_, indices, output); | ||
output.is_dense = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it necessary to put this last?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we copy from the original pointcloud, it also copy is_dense from the original cloud, which could be false, but after this filtering it should be true.
But I'm not sure if all filters should remove nan values if doesn't have to keep the output cloud organized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked and not all subclasses of FilterIndices
guarantee that indices
contain no invalid/nan points. E.g. RandomSample
may sample invalid points. Also for some other classes this might not be guaranteed if negative_==true
. Maybe it is best if we leave the code in this file unchanged (or delete output.is_dense = true;
), and in the future we can consider modifying copyPointCloud
to check if the output cloud is now dense.
But I'm not sure if all filters should remove nan values if doesn't have to keep the output cloud organized.
I think it makes sense to remove nan values to stay consistent with keep_organized_==false
. Also, user_filter_value_
may be anything (not necessarily nan).
Set those to remove to 0 in the to_keep array. Fix indexing and minor things.
Hmm, isn't the negative_ and extract_removed_indices_ kinda the same function? |
Ah, its either: |
Okay, so in other words: indices belonging to invalid points are always put in the I find the logic in the final for-loop a bit too complicated, though. Currently, |
Simplify the second pass.
I think I have managed to get what you suggested, though slightly different - getting inspired by the implementation in the passhrough filter. |
applyFilter (indices); | ||
pcl::copyPointCloud (*input_, indices, output); | ||
output.is_dense = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked and not all subclasses of FilterIndices
guarantee that indices
contain no invalid/nan points. E.g. RandomSample
may sample invalid points. Also for some other classes this might not be guaranteed if negative_==true
. Maybe it is best if we leave the code in this file unchanged (or delete output.is_dense = true;
), and in the future we can consider modifying copyPointCloud
to check if the output cloud is now dense.
But I'm not sure if all filters should remove nan values if doesn't have to keep the output cloud organized.
I think it makes sense to remove nan values to stay consistent with keep_organized_==false
. Also, user_filter_value_
may be anything (not necessarily nan).
3ff1fe9
to
c23f6ba
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
See #6180 for reference