Ground Filters

grdfilter module. A algorithms for filter ground returns using pylidar.

Classify Ground Returns

Functions to classify the ground returns within the point cloud.

pylidar.toolbox.grdfilters.classGrdReturns.classifyGroundReturns(ptBinVals, grdSurf, thres)[source]

A function to classify the ground return points within a distance from a ground surface. * ptBinVals is a binned list of points * grdSurf ground surface with the same dimensions as the binned points * thres is the threshold for defining whether a point is ground or not.

Progressive Morphology Filter

Functions used to implement the progressive morphological filter algorithm (Zhang et al., 2003) to generate a raster surface which can be used to classify the ground returns.

Zhang, K., Chen, S., Whitman, D., Shyu, M., Yan, J., & Zhang, C. (2003). A progressive morphological filter for removing nonground measurements from airborne LIDAR data. IEEE Transactions on Geoscience and Remote Sensing, 41(4), 872-882.

pylidar.toolbox.grdfilters.pmf.applyPMF(dataArr, noDataMask, binGeoSize, initWinSize=1, maxWinSize=12, winSizeInc=1, slope=0.3, dh0=0.3, dhmax=5, expWinSizes=False)[source]

Apply the progressive morphology filter (PMF) to the input data array (dataArr) filtering the surface to remove regions which are not ground.

  • dataArr is a numpy array, usually defined as minimum Z LiDAR return within bin, on which the filter is to be applied.
  • noDataMask is a numpy array specifying the cells in the input dataArr which do not have data (i.e., there were no points in the bin)
  • binGeoSize is the geographic (i.e., in metres) size of each square bin (i.e., 1 m)
  • initWinSize is the initial window size (Default = 1)
  • maxWinSize is the maximum window size (Default = 12)
  • winSizeInc is the increment for the window size (Default = 1)
  • slope is the slope within the scene (Default = 0.3)
  • dh0 is the initial height difference threshold for differentiating ground returns (Default = 0.3)
  • dhmax is the maximum height difference threshold for differentiating ground returns (Default = 5)
  • expWinSizes is a boolean specifying whether the windows sizes should increase exponentially or not (Default = False)

Returns: PMF Filtered array with the same data type as the input.

pylidar.toolbox.grdfilters.pmf.disk(radius, dtype=<type 'numpy.uint8'>)[source]

Generates a flat, disk-shaped structuring element. A pixel is within the neighborhood if the euclidean distance between it and the origin is no greater than radius. Parameters:

  • radius : int The radius of the disk-shaped structuring element.

Other Parameters:

  • dtype : data-type The data type of the structuring element.


  • selem : ndarray The structuring element where elements of the neighborhood are 1 and 0 otherwise.
pylidar.toolbox.grdfilters.pmf.doNearestNeighbourInterp(data, noDataMask, m, n)[source]

Function to do nearest neighbout interpolation of filling in no data area

pylidar.toolbox.grdfilters.pmf.doOpening(iarray, maxWindowSize, winSize1, c, s, dh0, dhmax)[source]

A function to perform a series of iterative opening operations on the data array with increasing window sizes.

pylidar.toolbox.grdfilters.pmf.elevationDiffTreshold(c, wk, wk1, s, dh0, dhmax)[source]

Function to determine the elevation difference threshold based on window size (wk) c is the bin size is metres. Default values for site slope (s), initial elevation differents (dh0), and maximum elevation difference (dhmax). These will change based on environment.