-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
FarthestPointDownSample: arg to specify start index to start downsampling from #7076
base: main
Are you sure you want to change the base?
Conversation
Thanks for submitting this pull request! The maintainers of this repository would appreciate if you could update the CHANGELOG.md based on your changes. |
utility::LogError("Illegal start index: {}, must <= point size: {}", | ||
start_index, num_points); | ||
} else if (start_index > | ||
static_cast<size_t>(std::numeric_limits<int64_t>::max())) { |
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.
This check ensures that the static_cast
down below does not result in undefined behavior. Is there a better way to do this check?
Also, not fully sure why int64_t
is being used in the first place in this function
{0, 1.0, 1.0}})); | ||
} // namespace tests | ||
std::shared_ptr<geometry::PointCloud> pcd_down_2 = | ||
pcd.FarthestPointDownSample(4, 0); |
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.
Another test could be added with a non-zero start_index
if I have a way to know what expected value to check against
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.
You can compute the result for non-zero start_index with the function and then use this in the unit test. I think this is ok here because there were no major changes to the algorithm.
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.
Thanks @abhishek47kashyap for the PR! Please have a look at the comments
{0, 1.0, 1.0}})); | ||
} // namespace tests | ||
std::shared_ptr<geometry::PointCloud> pcd_down_2 = | ||
pcd.FarthestPointDownSample(4, 0); |
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.
You can compute the result for non-zero start_index with the function and then use this in the unit test. I think this is ok here because there were no major changes to the algorithm.
Closes #7049.
The function
PointCloud::FarthestPointDownSample()
is overloaded to accept astart_index
in addition to the existingnum_samples
.Type
Motivation and Context
See ticket linked above.
Checklist:
python util/check_style.py --apply
to apply Open3D code styleto my code.
updated accordingly.
results (e.g. screenshots or numbers) here.
Description
This PR overloads the existing
PointCloud::FarthestPointDownSample()
to acceptsize_t start_index
as the desired index to start farthest point downsampling from. Bothgeometry
andt/geometry
have been updated and checks added to ensurestart_index
is valid. Input argumentsnum_samples
andstart_index
are markedconst
(existingnum_samples
was previously notconst
).Python bindings have been updated with
py::overload_cast
. Docstrings and unit tests have been modified accordingly.Output of unit tests