kopia lustrzana https://github.com/OpenDroneMap/ODM
Classify point cloud before generating derivative outputs
rodzic
30f89c068c
commit
fb85b754fb
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
3.3.5
|
3.4.0
|
||||||
|
|
|
@ -60,14 +60,14 @@ rerun_stages = {
|
||||||
'orthophoto_no_tiled': 'odm_orthophoto',
|
'orthophoto_no_tiled': 'odm_orthophoto',
|
||||||
'orthophoto_png': 'odm_orthophoto',
|
'orthophoto_png': 'odm_orthophoto',
|
||||||
'orthophoto_resolution': 'odm_orthophoto',
|
'orthophoto_resolution': 'odm_orthophoto',
|
||||||
'pc_classify': 'odm_dem',
|
'pc_classify': 'odm_georeferencing',
|
||||||
'pc_copc': 'odm_georeferencing',
|
'pc_copc': 'odm_georeferencing',
|
||||||
'pc_csv': 'odm_georeferencing',
|
'pc_csv': 'odm_georeferencing',
|
||||||
'pc_ept': 'odm_georeferencing',
|
'pc_ept': 'odm_georeferencing',
|
||||||
'pc_filter': 'openmvs',
|
'pc_filter': 'openmvs',
|
||||||
'pc_las': 'odm_georeferencing',
|
'pc_las': 'odm_georeferencing',
|
||||||
'pc_quality': 'opensfm',
|
'pc_quality': 'opensfm',
|
||||||
'pc_rectify': 'odm_dem',
|
'pc_rectify': 'odm_georeferencing',
|
||||||
'pc_sample': 'odm_filterpoints',
|
'pc_sample': 'odm_filterpoints',
|
||||||
'pc_skip_geometric': 'openmvs',
|
'pc_skip_geometric': 'openmvs',
|
||||||
'primary_band': 'dataset',
|
'primary_band': 'dataset',
|
||||||
|
|
|
@ -9,6 +9,8 @@ from opendm.concurrency import parallel_map
|
||||||
from opendm.utils import double_quote
|
from opendm.utils import double_quote
|
||||||
from opendm.boundary import as_polygon, as_geojson
|
from opendm.boundary import as_polygon, as_geojson
|
||||||
from opendm.dem.pdal import run_pipeline
|
from opendm.dem.pdal import run_pipeline
|
||||||
|
from opendm.opc import classify
|
||||||
|
from opendm.dem import commands
|
||||||
|
|
||||||
def ply_info(input_ply):
|
def ply_info(input_ply):
|
||||||
if not os.path.exists(input_ply):
|
if not os.path.exists(input_ply):
|
||||||
|
@ -274,6 +276,32 @@ def merge_ply(input_point_cloud_files, output_file, dims=None):
|
||||||
system.run(' '.join(cmd))
|
system.run(' '.join(cmd))
|
||||||
|
|
||||||
def post_point_cloud_steps(args, tree, rerun=False):
|
def post_point_cloud_steps(args, tree, rerun=False):
|
||||||
|
# Classify and rectify before generating derivate files
|
||||||
|
if args.pc_classify:
|
||||||
|
pc_classify_marker = os.path.join(tree.odm_georeferencing, 'pc_classify_done.txt')
|
||||||
|
|
||||||
|
if not io.file_exists(pc_classify_marker) or rerun:
|
||||||
|
log.ODM_INFO("Classifying {} using Simple Morphological Filter (1/2)".format(tree.odm_georeferencing_model_laz))
|
||||||
|
commands.classify(tree.odm_georeferencing_model_laz,
|
||||||
|
args.smrf_scalar,
|
||||||
|
args.smrf_slope,
|
||||||
|
args.smrf_threshold,
|
||||||
|
args.smrf_window
|
||||||
|
)
|
||||||
|
|
||||||
|
log.ODM_INFO("Classifying {} using OpenPointClass (2/2)".format(tree.odm_georeferencing_model_laz))
|
||||||
|
classify(tree.odm_georeferencing_model_laz, args.max_concurrency)
|
||||||
|
|
||||||
|
with open(pc_classify_marker, 'w') as f:
|
||||||
|
f.write('Classify: smrf\n')
|
||||||
|
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))
|
||||||
|
|
||||||
|
if args.pc_rectify:
|
||||||
|
commands.rectify(tree.odm_georeferencing_model_laz)
|
||||||
|
|
||||||
# XYZ point cloud output
|
# XYZ point cloud output
|
||||||
if args.pc_csv:
|
if args.pc_csv:
|
||||||
log.ODM_INFO("Creating CSV file (XYZ format)")
|
log.ODM_INFO("Creating CSV file (XYZ format)")
|
||||||
|
|
|
@ -12,7 +12,6 @@ from opendm.cropper import Cropper
|
||||||
from opendm import pseudogeo
|
from opendm import pseudogeo
|
||||||
from opendm.tiles.tiler import generate_dem_tiles
|
from opendm.tiles.tiler import generate_dem_tiles
|
||||||
from opendm.cogeo import convert_to_cogeo
|
from opendm.cogeo import convert_to_cogeo
|
||||||
from opendm.opc import classify
|
|
||||||
|
|
||||||
class ODMDEMStage(types.ODM_Stage):
|
class ODMDEMStage(types.ODM_Stage):
|
||||||
def process(self, args, outputs):
|
def process(self, args, outputs):
|
||||||
|
@ -35,7 +34,6 @@ class ODMDEMStage(types.ODM_Stage):
|
||||||
ignore_resolution=ignore_resolution and args.ignore_gsd,
|
ignore_resolution=ignore_resolution and args.ignore_gsd,
|
||||||
has_gcp=reconstruction.has_gcp())
|
has_gcp=reconstruction.has_gcp())
|
||||||
|
|
||||||
log.ODM_INFO('Classify: ' + str(args.pc_classify))
|
|
||||||
log.ODM_INFO('Create DSM: ' + str(args.dsm))
|
log.ODM_INFO('Create DSM: ' + str(args.dsm))
|
||||||
log.ODM_INFO('Create DTM: ' + str(args.dtm))
|
log.ODM_INFO('Create DTM: ' + str(args.dtm))
|
||||||
log.ODM_INFO('DEM input file {0} found: {1}'.format(dem_input, str(pc_model_found)))
|
log.ODM_INFO('DEM input file {0} found: {1}'.format(dem_input, str(pc_model_found)))
|
||||||
|
@ -45,34 +43,9 @@ class ODMDEMStage(types.ODM_Stage):
|
||||||
if not io.dir_exists(odm_dem_root):
|
if not io.dir_exists(odm_dem_root):
|
||||||
system.mkdir_p(odm_dem_root)
|
system.mkdir_p(odm_dem_root)
|
||||||
|
|
||||||
if args.pc_classify and pc_model_found:
|
|
||||||
pc_classify_marker = os.path.join(odm_dem_root, 'pc_classify_done.txt')
|
|
||||||
|
|
||||||
if not io.file_exists(pc_classify_marker) or self.rerun():
|
|
||||||
log.ODM_INFO("Classifying {} using Simple Morphological Filter (1/2)".format(dem_input))
|
|
||||||
commands.classify(dem_input,
|
|
||||||
args.smrf_scalar,
|
|
||||||
args.smrf_slope,
|
|
||||||
args.smrf_threshold,
|
|
||||||
args.smrf_window
|
|
||||||
)
|
|
||||||
|
|
||||||
log.ODM_INFO("Classifying {} using OpenPointClass (2/2)".format(dem_input))
|
|
||||||
classify(dem_input, args.max_concurrency)
|
|
||||||
|
|
||||||
with open(pc_classify_marker, 'w') as f:
|
|
||||||
f.write('Classify: smrf\n')
|
|
||||||
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))
|
|
||||||
|
|
||||||
progress = 20
|
progress = 20
|
||||||
self.update_progress(progress)
|
self.update_progress(progress)
|
||||||
|
|
||||||
if args.pc_rectify:
|
|
||||||
commands.rectify(dem_input)
|
|
||||||
|
|
||||||
# Do we need to process anything here?
|
# Do we need to process anything here?
|
||||||
if (args.dsm or args.dtm) and pc_model_found:
|
if (args.dsm or args.dtm) and pc_model_found:
|
||||||
dsm_output_filename = os.path.join(odm_dem_root, 'dsm.tif')
|
dsm_output_filename = os.path.join(odm_dem_root, 'dsm.tif')
|
||||||
|
@ -120,7 +93,7 @@ class ODMDEMStage(types.ODM_Stage):
|
||||||
if args.cog:
|
if args.cog:
|
||||||
convert_to_cogeo(dem_geotiff_path, max_workers=args.max_concurrency)
|
convert_to_cogeo(dem_geotiff_path, max_workers=args.max_concurrency)
|
||||||
|
|
||||||
progress += 30
|
progress += 40
|
||||||
self.update_progress(progress)
|
self.update_progress(progress)
|
||||||
else:
|
else:
|
||||||
log.ODM_WARNING('Found existing outputs in: %s' % odm_dem_root)
|
log.ODM_WARNING('Found existing outputs in: %s' % odm_dem_root)
|
||||||
|
|
Ładowanie…
Reference in New Issue