-
-
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
the localmaximum filter bug #4999
Comments
I just take a look at the code and @xq198109 is right This marks the point visited pcl/filters/include/pcl/filters/impl/local_maximum.hpp Lines 161 to 167 in cd99687
And this skips those points without adding them to the result pcl/filters/include/pcl/filters/impl/local_maximum.hpp Lines 122 to 125 in cd99687
But I think whether pcl/filters/include/pcl/filters/impl/local_maximum.hpp Lines 147 to 157 in cd99687
|
the iteration skips the first point(k=0), which compare Z value. the indce of Query point is also in the radius_indices , if radius_indices is not sorted, the first point may be not the Query point, that could cause wrong judgment.
At 2021-10-28 06:09:38, "tin1254" ***@***.***> wrote:
I just take a look at the code and @xq198109 is right
This marks the point visited
https://github.com/PointCloudLibrary/pcl/blob/cd99687bd1f332d77aee06a8e9fbad4fb08c0a44/filters/include/pcl/filters/impl/local_maximum.hpp#L161-L167
And this skips those points without adding them to the result
https://github.com/PointCloudLibrary/pcl/blob/cd99687bd1f332d77aee06a8e9fbad4fb08c0a44/filters/include/pcl/filters/impl/local_maximum.hpp#L122-L125
But I think whether radius_indices is sorted or not won't affect the result though. As long as it finds any neighbor point is higher than the current point, and it doesn't matter which higher point is found first
https://github.com/PointCloudLibrary/pcl/blob/cd99687bd1f332d77aee06a8e9fbad4fb08c0a44/filters/include/pcl/filters/impl/local_maximum.hpp#L147-L157
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
|
Thank you @xq198109 for reporting this and @tin1254 for looking into it further. |
@mvieth I want to work on this issue. |
I've been very busy lately, it would be great if @ArkaprabhaChakraborty can work on this |
@mvieth Can I get a head start? |
Basically what I described in my comment above: Write more tests to show that the current behaviour is wrong, then fix the wrong behaviour so that the new tests pass. I think the apparent problem(s) are sufficiently explained in the other comments |
@mvieth k=0 is the query point itself, right? This would be because the (projected) point closest to a query point (from the projected cloud) is... the (projected) point itself How does looping from k=0 change anything? What am I missing here? Current code with inline comments marked with point_is_max[iii] = true;
point_is_visited[iii] = true;
// find neighbors (code skipped)
// Check to see if a neighbor is higher than the query point
float query_z = (*input_)[iii].z;
for (std::size_t k = 1; k < radius_indices.size (); ++k) // k = 1 is the first neighbor
{
if ((*input_)[radius_indices[k]].z > query_z) // <--- this would be false for k=0, so we just skip onto k=1
{
// Query point is not the local max, no need to check others
point_is_max[iii] = false;
break;
}
}
// If the query point was a local max, all neighbors can be marked as
// visited, excluding them from future consideration as local maxima
if (point_is_max[iii])
{
for (std::size_t k = 1; k < radius_indices.size (); ++k) // k = 1 is the first neighbor
{
point_is_visited[radius_indices[k]] = true; // <--- this is already true for k = 0
}
} |
It might be a bigger issue in that case. I've seen this assumption in a lot of places. ~/workspace/pcl$ grep '\[0\] should be' -nri
features/include/pcl/features/impl/our_cvfh.hpp:127: for (std::size_t j = 1; j < nn_indices.size (); ++j) // nn_indices[0] should be sq_idx
recognition/include/pcl/recognition/impl/hv/hv_go.hpp:99: for (std::size_t j = 1; j < nn_indices.size (); ++j) // nn_indices[0] should be sq_idx
segmentation/include/pcl/segmentation/extract_clusters.h:154: for (std::size_t j = 1; j < nn_indices.size (); ++j) // nn_indices[0] should be sq_idx
segmentation/include/pcl/segmentation/extract_clusters.h:274: for (std::size_t j = 1; j < nn_indices.size (); ++j) // nn_indices[0] should be sq_idx
segmentation/include/pcl/segmentation/impl/extract_labeled_clusters.hpp:111: ++j) // nn_indices[0] should be sq_idx
segmentation/include/pcl/segmentation/impl/seeded_hue_segmentation.hpp:99: for (std::size_t j = 1; j < nn_indices.size (); ++j) // nn_indices[0] should be sq_idx
segmentation/include/pcl/segmentation/impl/seeded_hue_segmentation.hpp:176: for (std::size_t j = 1; j < nn_indices.size (); ++j) // nn_indices[0] should be sq_idx Checked the source code of difference search providers. Good assumption (Checked
Bad assumption:
This is valid for both cpu and cuda/gpu implementations. Flann's code is a big foreign to me, but it doesn't seem promising because it's using omp (which definitely wouldn't guarantee order) TL;DR: fix is correct, but we might have a bigger problem at hand |
Actually I also saw this when I worked with the extract_clusters and GPU/CUDA with @FabianSchuetze, but here it didn't matter because it was already added to the cluster, except a bit of processing time ofc. I guess we should investigate in found cases supplied by your search @kunaltyagi. |
Also found that FLANN might not be a good assumption in all cases. I think we should create a separate issue to track this mess |
Hello @mvieth . Is this issue still available? I would like to work on it. Can you please assign this to me and give me a head start? |
@sourav25998 I believe this issue is more complex than it initially appeared. So it might not qualify as a "good first issue" and you may want to look for another issue to work on. |
the localmaxmum fliter has an error in flitered point indces, the Points in the neighborhood of a previously identified local max can not be added to indces. the code can be modified as follow:
the code which check to see if a neighbor is higher than the query point assume the radius_indices is sorted, the searcher_ should be set sorted, the code can be modified as follow:
The text was updated successfully, but these errors were encountered: