Skip to content
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

Merged
merged 9 commits into from
Dec 9, 2024

Conversation

abhishek47kashyap
Copy link
Contributor

Closes #7049.

The function PointCloud::FarthestPointDownSample() is overloaded to accept a start_index in addition to the existing num_samples.

Type

  • Bug fix (non-breaking change which fixes an issue): Fixes #
  • New feature (non-breaking change which adds functionality). Resolves #
  • Breaking change (fix or feature that would cause existing functionality to not work as expected) Resolves #

Motivation and Context

See ticket linked above.

Checklist:

  • I have run python util/check_style.py --apply to apply Open3D code style
    to my code.
  • This PR changes Open3D behavior or adds new functionality.
    • Both C++ (Doxygen) and Python (Sphinx / Google style) documentation is
      updated accordingly.
    • I have added or updated C++ and / or Python unit tests OR included test
      results
      (e.g. screenshots or numbers) here.
  • I will follow up and update the code if CI fails.
  • For fork PRs, I have selected Allow edits from maintainers.

Description

This PR overloads the existing PointCloud::FarthestPointDownSample() to accept size_t start_index as the desired index to start farthest point downsampling from. Both geometry and t/geometry have been updated and checks added to ensure start_index is valid. Input arguments num_samples and start_index are marked const (existing num_samples was previously not const).

Python bindings have been updated with py::overload_cast. Docstrings and unit tests have been modified accordingly.

Output of unit tests
~/open3d/build$ ./bin/tests --gtest_filter=PointCloud.FarthestPointDownSample*
[Open3D INFO] CompilerInfo: C++ 17, GNU 11.4.0, CUDA disabled.
[Open3D INFO] CPUInfo: 8 cores, 16 threads.
[Open3D INFO] ISAInfo: AVX512SKX instruction set used in ISPC code.
Note: Google Test filter = PointCloud.FarthestPointDownSample*
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from PointCloud
[ RUN      ] PointCloud.FarthestPointDownSample
[Open3D DEBUG] Pointcloud down sampled from 8 points to 4 points.
[Open3D DEBUG] Pointcloud down sampled from 8 points to 4 points.
[       OK ] PointCloud.FarthestPointDownSample (0 ms)
[----------] 1 test from PointCloud (0 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (0 ms total)
[  PASSED  ] 1 test.



~/open3d/build$ ./bin/tests --gtest_filter=PointCloud/PointCloudPermuteDevices.FarthestPointDownSample*
[Open3D INFO] CompilerInfo: C++ 17, GNU 11.4.0, CUDA disabled.
[Open3D INFO] CPUInfo: 8 cores, 16 threads.
[Open3D INFO] ISAInfo: AVX512SKX instruction set used in ISPC code.
Note: Google Test filter = PointCloud/PointCloudPermuteDevices.FarthestPointDownSample*
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from PointCloud/PointCloudPermuteDevices
[ RUN      ] PointCloud/PointCloudPermuteDevices.FarthestPointDownSample/0
[Open3D DEBUG] Pointcloud down sampled from 8 points to 4 points.
[Open3D DEBUG] Pointcloud down sampled from 8 points to 4 points.
[       OK ] PointCloud/PointCloudPermuteDevices.FarthestPointDownSample/0 (2 ms)
[----------] 1 test from PointCloud/PointCloudPermuteDevices (2 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (2 ms total)
[  PASSED  ] 1 test.

Copy link

update-docs bot commented Nov 25, 2024

Thanks for submitting this pull request! The maintainers of this repository would appreciate if you could update the CHANGELOG.md based on your changes.

Copy link
Contributor

@benjaminum benjaminum left a 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

cpp/tests/geometry/PointCloud.cpp Outdated Show resolved Hide resolved
@abhishek47kashyap
Copy link
Contributor Author

Comments have been addressed, with the main change being argument start_index has default 0

@benjaminum
Copy link
Contributor

@abhishek47kashyap looks good. Thanks!

@benjaminum benjaminum merged commit 7354eb1 into isl-org:main Dec 9, 2024
29 of 38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FarthestPointDownSample: starting with an index other than 0
2 participants