Source code for pylidar.toolbox.grdfilters.classGrdReturns

"""
Functions to classify the ground returns within the point cloud.
"""
# This file is part of PyLidar
# Copyright (C) 2015 John Armston, Pete Bunting, Neil Flood, Sam Gillingham
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

from __future__ import print_function, division

import os
import numpy


[docs]def classifyGroundReturns(ptBinVals, grdSurf, thres): """ 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. """ ptBinVals['CLASSIFICATION'] = numpy.where( ptBinVals['CLASSIFICATION'] == 3, 0, ptBinVals['CLASSIFICATION']) ptBinVals['CLASSIFICATION'] = numpy.where( numpy.absolute(ptBinVals['Z'] - grdSurf) < thres, 3, ptBinVals['CLASSIFICATION'])