OpenDroneMap-ODM/scripts/odm_filterpoints.py

34 wiersze
1.2 KiB
Python
Czysty Zwykły widok Historia

2019-04-22 19:14:39 +00:00
import os
from opendm import log
from opendm import io
from opendm import system
from opendm import context
from opendm import point_cloud
2019-04-22 19:14:39 +00:00
from opendm import types
2019-04-22 19:14:39 +00:00
class ODMFilterPoints(types.ODM_Stage):
def process(self, args, outputs):
tree = outputs['tree']
reconstruction = outputs['reconstruction']
if not os.path.exists(tree.odm_filterpoints): system.mkdir_p(tree.odm_filterpoints)
# check if reconstruction was done before
2019-04-22 19:14:39 +00:00
if not io.file_exists(tree.filtered_point_cloud) or self.rerun():
if args.fast_orthophoto:
inputPointCloud = os.path.join(tree.opensfm, 'reconstruction.ply')
elif args.use_opensfm_dense:
inputPointCloud = tree.opensfm_model
else:
inputPointCloud = tree.mve_model
confidence = None
if not args.use_opensfm_dense and not args.fast_orthophoto:
confidence = args.mve_confidence
point_cloud.filter(inputPointCloud, tree.filtered_point_cloud, standard_deviation=args.pc_filter, confidence=confidence, verbose=args.verbose)
else:
log.ODM_WARNING('Found a valid point cloud file in: %s' %
tree.filtered_point_cloud)