kopia lustrzana https://github.com/OpenDroneMap/ODM
Exposed SMRF parameters
rodzic
fa3008cb66
commit
2b74a03780
|
@ -226,7 +226,7 @@ def config():
|
|||
'and default value: %(default)s'))
|
||||
|
||||
parser.add_argument('--mesh-point-weight',
|
||||
metavar='<interpolation weight>',
|
||||
metavar='<positive float>',
|
||||
default=4,
|
||||
type=float,
|
||||
help=('This floating point value specifies the importance'
|
||||
|
@ -279,6 +279,38 @@ def config():
|
|||
'\nDefault: '
|
||||
'%(default)s')
|
||||
|
||||
parser.add_argument('--smrf-scalar',
|
||||
metavar='<positive float>',
|
||||
type=float,
|
||||
default=1.25,
|
||||
help='Simple Morphological Filter elevation scalar parameter. '
|
||||
'\nDefault: '
|
||||
'%(default)s')
|
||||
|
||||
parser.add_argument('--smrf-slope',
|
||||
metavar='<positive float>',
|
||||
type=float,
|
||||
default=0.15,
|
||||
help='Simple Morphological Filter slope parameter (rise over run). '
|
||||
'\nDefault: '
|
||||
'%(default)s')
|
||||
|
||||
parser.add_argument('--smrf-threshold',
|
||||
metavar='<positive float>',
|
||||
type=float,
|
||||
default=0.5,
|
||||
help='Simple Morphological Filter elevation threshold parameter (meters). '
|
||||
'\nDefault: '
|
||||
'%(default)s')
|
||||
|
||||
parser.add_argument('--smrf-window',
|
||||
metavar='<positive float>',
|
||||
type=float,
|
||||
default=18.0,
|
||||
help='Simple Morphological Filter window radius parameter (meters). '
|
||||
'\nDefault: '
|
||||
'%(default)s')
|
||||
|
||||
parser.add_argument('--texturing-data-term',
|
||||
metavar='<string>',
|
||||
default='gmi',
|
||||
|
@ -359,14 +391,14 @@ def config():
|
|||
parser.add_argument('--dtm',
|
||||
action='store_true',
|
||||
default=False,
|
||||
help='Use this tag to build a DTM (Digital Terrain Model, ground only) using a progressive '
|
||||
'morphological filter. Check the --dem* parameters for fine tuning.')
|
||||
help='Use this tag to build a DTM (Digital Terrain Model, ground only) using a simple '
|
||||
'morphological filter. Check the --dem* and --smrf* parameters for finer tuning.')
|
||||
|
||||
parser.add_argument('--dsm',
|
||||
action='store_true',
|
||||
default=False,
|
||||
help='Use this tag to build a DSM (Digital Surface Model, ground + objects) using a progressive '
|
||||
'morphological filter. Check the --dem* parameters for fine tuning.')
|
||||
'morphological filter. Check the --dem* parameters for finer tuning.')
|
||||
|
||||
parser.add_argument('--dem-gapfill-steps',
|
||||
metavar='<positive integer>',
|
||||
|
|
|
@ -18,11 +18,11 @@ import threading
|
|||
|
||||
from . import pdal
|
||||
|
||||
def classify(lasFile, slope=0.15, cellsize=1, maxWindowSize=18, verbose=False):
|
||||
def classify(lasFile, scalar, slope, threshold, window, verbose=False):
|
||||
start = datetime.now()
|
||||
|
||||
try:
|
||||
pdal.run_pdaltranslate_smrf(lasFile, lasFile, slope, cellsize, maxWindowSize, verbose)
|
||||
pdal.run_pdaltranslate_smrf(lasFile, lasFile, scalar, slope, threshold, window, verbose)
|
||||
except:
|
||||
raise Exception("Error creating classified file %s" % fout)
|
||||
|
||||
|
|
|
@ -163,7 +163,7 @@ def run_pipeline(json, verbose=False):
|
|||
os.remove(jsonfile)
|
||||
|
||||
|
||||
def run_pdaltranslate_smrf(fin, fout, slope, cellsize, maxWindowSize, verbose=False):
|
||||
def run_pdaltranslate_smrf(fin, fout, scalar, slope, threshold, window, verbose=False):
|
||||
""" Run PDAL translate """
|
||||
cmd = [
|
||||
'pdal',
|
||||
|
@ -171,11 +171,11 @@ def run_pdaltranslate_smrf(fin, fout, slope, cellsize, maxWindowSize, verbose=Fa
|
|||
'-i %s' % fin,
|
||||
'-o %s' % fout,
|
||||
'smrf',
|
||||
'--filters.smrf.cell=%s' % cellsize,
|
||||
'--filters.smrf.scalar=%s' % scalar,
|
||||
'--filters.smrf.slope=%s' % slope,
|
||||
'--filters.smrf.threshold=%s' % threshold,
|
||||
'--filters.smrf.window=%s' % window,
|
||||
]
|
||||
if maxWindowSize is not None:
|
||||
cmd.append('--filters.smrf.window=%s' % maxWindowSize)
|
||||
|
||||
if verbose:
|
||||
print ' '.join(cmd)
|
||||
|
|
|
@ -43,8 +43,6 @@ class ODMDEMCell(ecto.Cell):
|
|||
log.ODM_INFO('Create DTM: ' + str(args.dtm))
|
||||
log.ODM_INFO('DEM input file {0} found: {1}'.format(tree.odm_georeferencing_model_laz, str(las_model_found)))
|
||||
|
||||
slope, cellsize = (0.15, 1)
|
||||
|
||||
# define paths and create working directories
|
||||
odm_dem_root = tree.path('odm_dem')
|
||||
if not io.dir_exists(odm_dem_root):
|
||||
|
@ -56,15 +54,19 @@ class ODMDEMCell(ecto.Cell):
|
|||
if not io.file_exists(pc_classify_marker) or rerun_cell:
|
||||
log.ODM_INFO("Classifying {} using Simple Morphological Filter".format(tree.odm_georeferencing_model_laz))
|
||||
commands.classify(tree.odm_georeferencing_model_laz,
|
||||
slope,
|
||||
cellsize,
|
||||
args.smrf_scalar,
|
||||
args.smrf_slope,
|
||||
args.smrf_threshold,
|
||||
args.smrf_window,
|
||||
verbose=args.verbose
|
||||
)
|
||||
|
||||
with open(pc_classify_marker, 'w') as f:
|
||||
f.write('Classify: smrf\n')
|
||||
f.write('Slope: {}\n'.format(slope))
|
||||
f.write('Cellsize: {}\n'.format(cellsize))
|
||||
f.write('Scalar: {}\n'.format(args.smrf_scalar))
|
||||
f.write('Slope: {}\n'.format(args.smrf_slope))
|
||||
f.write('Threshold: {}\n'.format(args.smrf_threshold))
|
||||
f.write('Window: {}\n'.format(args.smrf_window))
|
||||
|
||||
# Do we need to process anything here?
|
||||
if (args.dsm or args.dtm) and las_model_found:
|
||||
|
|
Ładowanie…
Reference in New Issue