PclSharp
repository·master·Indexed 41 days ago
https://github.com/jbruening/pclsharpC# P/Invoke bindings for the Point Cloud Library (PCL), enabling point cloud processing capabilities within the .NET ecosystem. Includes implementations such as the HeightMap2D filter for identifying local maxima in 2D height maps.
What's inside PclSharp
- Because the project utilizes C# 7 features, you must use Visual Studio 2017 or later to build the project from source.
Install PclSharp via NuGet
masterPclSharp provides P/Invoke bindings for the Point Cloud Library (PCL) for use in C#. You can install it as a NuGet package to use PCL functionality within your C# projects.
https://www.nuget.org/packages/PclSharp/Reference: HeightMap2D configuration methods
masterMethods for configuring the
HeightMap2Dfilter parameters.void setGroundCoeffs(const Eigen::VectorXf &ground_coeffs); void setMinDistBetweenMaxima(const float &dist); float getMinDistBetweenMaxima(); void setBinSize(const float &value); float getBinSize(); int getMaximaNumberAfterFiltering();Use the HeightMap2D filter
masterThe
HeightMap2D<PointT>class is a filter used to identify local maxima in a 2D height map derived from a point cloud. It works by binning points into a grid (defined bybin_size_), finding the highest point in each bin, and then performing two stages of processing:- Local Maxima Search: Identifies points that are higher than their immediate neighbors in the grid.
- Maxima Filtering: Filters the identified maxima based on a minimum distance constraint (
min_dist_between_maxima_) to prevent clusters of points from being identified as multiple maxima.
To use the filter, you must provide ground plane coefficients and then call
filter().// Example conceptual usage of HeightMap2D PclSharp::filters::HeightMap2D<pcl::PointXYZ> filter; // 1. Set ground plane coefficients (normal x, y, z and offset d) // representing the plane equation: ax + by + cz + d = 0 Eigen::VectorXf ground_coeffs(4); ground_coeffs << 0.0, 0.0, 1.0, 0.0; filter.setGroundCoeffs(ground_coeffs); // 2. Configure parameters filter.setBinSize(0.06f); filter.setMinDistBetweenMaxima(0.3f); // 3. Run the filter filter.setInput(cloud); filter.filter(); // 4. Retrieve results std::vector<int>& indices = filter.getMaximaCloudIndicesFiltered(); int count = filter.getMaximaNumberAfterFiltering();Configure HeightMap2D parameters
masterThe
HeightMap2Dfilter can be tuned using the following methods:setGroundCoeffs(const Eigen::VectorXf &ground_coeffs): Sets the coefficients for the ground plane. The vector must have exactly 4 elements representing the plane equation $ax + by + cz + d = 0$. The first three elements are the normal vector $(a, b, c)$ and the fourth is the offset $d$.setMinDistBetweenMaxima(const float &dist): Sets the minimum distance required between identified maxima. This is useful for separating distinct objects (e.g., human heads).setBinSize(const float &value): Sets the size of the 2D grid bins used to discretize the point cloud.
Getter methods
getMinDistBetweenMaxima(),getBinSize(), andgetMaximaNumberAfterFiltering()are available to retrieve current settings and results.