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

Faster organized radius search #6160

Merged
merged 1 commit into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion search/include/pcl/search/impl/organized.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ pcl::search::OrganizedNeighbor<PointT>::radiusSearch (const PointT
{
for (; idx < xEnd; ++idx)
{
if (!mask_[idx] || !isFinite ((*input_)[idx]))
if (!mask_[idx])
continue;

float dist_x = (*input_)[idx].x - query.x;
Expand Down
15 changes: 11 additions & 4 deletions search/include/pcl/search/organized.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include <pcl/memory.h>
#include <pcl/pcl_macros.h>
#include <pcl/point_cloud.h>
#include <pcl/common/point_tests.h> // for pcl::isFinite
#include <pcl/search/search.h>
#include <pcl/common/eigen.h>

Expand Down Expand Up @@ -138,10 +139,16 @@ namespace pcl
{
mask_.assign (input_->size (), 0);
for (const auto& idx : *indices_)
mask_[idx] = 1;
if (pcl::isFinite((*input_)[idx]))
mask_[idx] = 1;
}
else
mask_.assign (input_->size (), 1);
{
mask_.assign (input_->size (), 0);
for (std::size_t idx=0; idx<input_->size(); ++idx)
if (pcl::isFinite((*input_)[idx]))
mask_[idx] = 1;
}

return estimateProjectionMatrix () && isValid ();
}
Expand Down Expand Up @@ -216,7 +223,7 @@ namespace pcl
testPoint (const PointT& query, unsigned k, std::vector<Entry>& queue, index_t index) const
{
const PointT& point = input_->points [index];
if (mask_ [index] && std::isfinite (point.x))
if (mask_ [index])
{
//float squared_distance = (point.getVector3fMap () - query.getVector3fMap ()).squaredNorm ();
float dist_x = point.x - query.x;
Expand Down Expand Up @@ -278,7 +285,7 @@ namespace pcl
/** \brief using only a subsample of points to calculate the projection matrix. pyramid_level_ = use down sampled cloud given by pyramid_level_*/
const unsigned pyramid_level_;

/** \brief mask, indicating whether the point was in the indices list or not.*/
/** \brief mask, indicating whether the point was in the indices list or not, and whether it is finite.*/
std::vector<unsigned char> mask_;
public:
PCL_MAKE_ALIGNED_OPERATOR_NEW
Expand Down