From 398f1c23afa9f5d07033ed1143aeda5ee55f6294 Mon Sep 17 00:00:00 2001 From: tinyRatP Date: Thu, 2 Jul 2020 10:34:36 +0800 Subject: [PATCH] Fixed copy point_cloud.ply if --pc-filter -0 Former-commit-id: 2f54b056dd28a7e59a867691d6e7a38fa900310b --- opendm/point_cloud.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/opendm/point_cloud.py b/opendm/point_cloud.py index e3d6b3c3..57a7569f 100644 --- a/opendm/point_cloud.py +++ b/opendm/point_cloud.py @@ -11,8 +11,14 @@ def filter(input_point_cloud, output_point_cloud, standard_deviation=2.5, meank= """ Filters a point cloud """ + if not os.path.exists(input_point_cloud): + log.ODM_ERROR("{} does not exist. The program will now exit.".format(input_point_cloud)) + sys.exit(1) + if (standard_deviation <= 0 or meank <= 0) and sample_radius <= 0: log.ODM_INFO("Skipping point cloud filtering") + # if using the option `--pc-filter 0`, we need copy input_point_cloud + shutil.copy(input_point_cloud, output_point_cloud) return if standard_deviation > 0 and meank > 0: @@ -24,10 +30,6 @@ def filter(input_point_cloud, output_point_cloud, standard_deviation=2.5, meank= if sample_radius > 0: log.ODM_INFO("Sampling points around a %sm radius" % sample_radius) - if not os.path.exists(input_point_cloud): - log.ODM_ERROR("{} does not exist, cannot filter point cloud. The program will now exit.".format(input_point_cloud)) - sys.exit(1) - filter_program = os.path.join(context.odm_modules_path, 'odm_filterpoints') if not os.path.exists(filter_program): log.ODM_WARNING("{} program not found. Will skip filtering, but this installation should be fixed.")