Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,15 @@ namespace pcl

~ApproximateProgressiveMorphologicalFilter () override;

/** \brief Get the maximum window size to be used in filtering ground returns. */
/** \brief Get the maximum window size to be used in filtering ground returns.
* \return the maximum window size in number of grid cells
*/
inline int
getMaxWindowSize () const { return (max_window_size_); }

/** \brief Set the maximum window size to be used in filtering ground returns. */
/** \brief Set the maximum window size to be used in filtering ground returns.
* \param[in] max_window_size the maximum window size in number of grid cells
*/
inline void
setMaxWindowSize (int max_window_size) { max_window_size_ = max_window_size; }

Expand Down Expand Up @@ -143,7 +147,8 @@ namespace pcl

protected:

/** \brief Maximum window size to be used in filtering ground returns. */
/** \brief Maximum window size to be used in filtering ground returns, in
* number of grid cells. */
int max_window_size_{33};

/** \brief Slope value to be used in computing the height threshold. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,19 @@ namespace pcl

~ProgressiveMorphologicalFilter () override;

/** \brief Get the maximum window size to be used in filtering ground returns. */
inline int
/** \brief Get the maximum window size to be used in filtering ground returns.
* \return the maximum window size in the same units as the input cloud
* coordinates
*/
inline float
getMaxWindowSize () const { return (max_window_size_); }

/** \brief Set the maximum window size to be used in filtering ground returns. */
/** \brief Set the maximum window size to be used in filtering ground returns.
* \param[in] max_window_size the maximum window size in the same units as the
* input cloud coordinates
*/
inline void
setMaxWindowSize (int max_window_size) { max_window_size_ = max_window_size; }
setMaxWindowSize (float max_window_size) { max_window_size_ = max_window_size; }

/** \brief Get the slope value to be used in computing the height threshold. */
inline float
Expand Down Expand Up @@ -136,8 +142,9 @@ namespace pcl

protected:

/** \brief Maximum window size to be used in filtering ground returns. */
int max_window_size_{33};
/** \brief Maximum window size to be used in filtering ground returns, in the
* same units as the input cloud coordinates. */
float max_window_size_{33.0f};

/** \brief Slope value to be used in computing the height threshold. */
float slope_{0.7f};
Expand Down
4 changes: 4 additions & 0 deletions test/segmentation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ PCL_ADD_TEST(a_segmentation_test test_segmentation
LINK_WITH pcl_gtest pcl_io pcl_segmentation pcl_features pcl_kdtree pcl_search pcl_common
ARGUMENTS "${PCL_SOURCE_DIR}/test/bun0.pcd" "${PCL_SOURCE_DIR}/test/car6.pcd" "${PCL_SOURCE_DIR}/test/colored_cloud.pcd")

PCL_ADD_TEST(progressive_morphological_filter test_progressive_morphological_filter
FILES test_progressive_morphological_filter.cpp
LINK_WITH pcl_gtest pcl_segmentation)

PCL_ADD_TEST(a_prism_test test_concave_prism
FILES test_concave_prism.cpp
LINK_WITH pcl_gtest pcl_segmentation pcl_common)
Expand Down
33 changes: 33 additions & 0 deletions test/segmentation/test_progressive_morphological_filter.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* SPDX-License-Identifier: BSD-3-Clause
*
* Point Cloud Library (PCL) - www.pointclouds.org
* Copyright (c) 2026-, Open Perception Inc.
*
* All rights reserved
*/

#include <pcl/segmentation/progressive_morphological_filter.h>
#include <pcl/test/gtest.h>
#include <pcl/point_types.h>

#include <type_traits>

TEST(ProgressiveMorphologicalFilter, FractionalMaximumWindowSize)
{
pcl::ProgressiveMorphologicalFilter<pcl::PointXYZ> filter;
static_assert(std::is_same_v<decltype(filter.getMaxWindowSize()), float>);

filter.setMaxWindowSize(6.25f);

EXPECT_FLOAT_EQ(filter.getMaxWindowSize(), 6.25f);
}

/* ---[ */
int
main(int argc, char** argv)
{
testing::InitGoogleTest(&argc, argv);
return (RUN_ALL_TESTS());
}
/* ]--- */
Loading