Skip to content

Commit

Permalink
Replace 'pdal ground' kernel usage of filters.pmf with filters.smrf¬ (#…
Browse files Browse the repository at this point in the history
…2427)

* Replace 'pdal ground' kernel usage of filters.pmf with filters.smrf¬

 * add 'ignore' and 'returns' option¬
 * reflect filters.smrf options

* Updates as requested by @chambbj

* update docs
  • Loading branch information
hobu committed May 3, 2019
1 parent 25d4831 commit 7acd9d3
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 24 deletions.
33 changes: 18 additions & 15 deletions doc/apps/ground.rst
Expand Up @@ -5,25 +5,28 @@ ground
********************************************************************************

The ``ground`` command is used to segment the input point cloud into ground
versus non-ground returns.
versus non-ground returns using :ref:`filters.smrf` and :ref:`filters.outlier`.

::

$ pdal ground [options] <input> <output>

::

--input, -i Input filename
--output, -o Output filename
--max_window_size Max window size
--slope Slope
--max_distance Max distance
--initial_distance Initial distance
--cell_size Cell size
--classify Apply classification labels?
--extract Extract ground returns?
--approximate, -a Use approximate algorithm? (much faster)
--reset Reset classification prior to segmentation.
--denoise Apply statistical outlier removal prior to segmentation.

For more information, see the full documentation for PDAL at http://pdal.io/
--input, -i Input filename
--output, -o Output filename
--max_window_size Max window size
--slope Slope
--max_distance Max distance
--initial_distance Initial distance
--cell_size Cell size
--extract Extract ground returns?
--reset Reset classifications prior to segmenting?
--denoise Apply statistical outlier removal prior to segmenting?
--returns Include last returns?
--scalar Elevation scalar?
--threshold Elevation threshold?
--cut Cut net size?
--ignore A range query to ignore when processing


27 changes: 19 additions & 8 deletions kernels/GroundKernel.cpp
Expand Up @@ -73,14 +73,20 @@ void GroundKernel::addSwitches(ProgramArgs& args)
{
args.add("input,i", "Input filename", m_inputFile).setPositional();
args.add("output,o", "Output filename", m_outputFile).setPositional();
args.add("max_window_size", "Max window size", m_maxWindowSize, 33.0);
args.add("slope", "Slope", m_slope, 1.0);
args.add("max_window_size", "Max window size", m_maxWindowSize, 18.0);
args.add("slope", "Slope", m_slope, 0.15);
args.add("max_distance", "Max distance", m_maxDistance, 2.5);
args.add("initial_distance", "Initial distance", m_initialDistance, .15);
args.add("cell_size", "Cell size", m_cellSize, 1.0);
args.add("extract", "Extract ground returns?", m_extract);
args.add("reset", "Reset classifications prior to segmenting?", m_reset);
args.add("denoise", "Apply statistical outlier removal prior to segmenting?", m_denoise);
args.add("returns", "Include last returns?", m_returns,
{"last", "only"});
args.add("scalar", "Elevation scalar?", m_scalar, 1.25);
args.add("threshold", "Elevation threshold?", m_threshold, 0.5);
args.add("cut", "Cut net size?", m_cut, 0.0);
args.add("ignore", "A range query to ignore when processing", m_ignored);
}

int GroundKernel::execute()
Expand All @@ -93,12 +99,16 @@ int GroundKernel::execute()
Options outlierOptions;

Options groundOptions;
groundOptions.add("max_window_size", m_maxWindowSize);
groundOptions.add("window", m_maxWindowSize);
groundOptions.add("threshold", m_threshold);
groundOptions.add("slope", m_slope);
groundOptions.add("max_distance", m_maxDistance);
groundOptions.add("initial_distance", m_initialDistance);
groundOptions.add("cell_size", m_cellSize);
groundOptions.add("ignore", "Classification[7:7]");
groundOptions.add("cell", m_cellSize);
groundOptions.add("cut", m_cut);
groundOptions.add("scalar", m_scalar);
for (auto& s: m_returns)
groundOptions.add("returns", s);
for(DimRange& r: m_ignored)
groundOptions.add("ignore", r);

Options rangeOptions;
rangeOptions.add("limits", "Classification[2:2]");
Expand All @@ -113,7 +123,8 @@ int GroundKernel::execute()
if (m_denoise)
outlierStage = &makeFilter("filters.outlier", *assignStage, outlierOptions);

Stage& groundStage = makeFilter("filters.pmf", *outlierStage, groundOptions);
Stage& groundStage = makeFilter("filters.smrf", *outlierStage, groundOptions);


Stage* rangeStage = &groundStage;
if (m_extract)
Expand Down
10 changes: 9 additions & 1 deletion kernels/GroundKernel.hpp
Expand Up @@ -38,7 +38,7 @@
#include <pdal/Kernel.hpp>
#include <pdal/pdal_export.hpp>
#include <pdal/util/FileUtils.hpp>

#include "../filters/private/DimRange.hpp"
#include <memory>
#include <string>

Expand All @@ -60,6 +60,7 @@ class PDAL_DLL GroundKernel : public Kernel

std::string m_inputFile;
std::string m_outputFile;
std::string m_ignore;
double m_maxWindowSize;
double m_slope;
double m_maxDistance;
Expand All @@ -68,6 +69,13 @@ class PDAL_DLL GroundKernel : public Kernel
bool m_extract;
bool m_reset;
bool m_denoise;
StringList m_returns;
double m_scalar;
double m_threshold;
double m_cut;
std::string m_dir;
std::vector<DimRange> m_ignored;

};

} // namespace pdal

0 comments on commit 7acd9d3

Please sign in to comment.