From 0e8fb34e7a7e1bb04d20e4d74fe71e2b48aec89f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BE=99=E6=BE=B3?= Date: Mon, 13 Jan 2025 10:52:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 --- main.py | 2 +- odm_preprocess.py | 1 - post_pro/merge_tif.py | 11 +++++++++++ utils/odm_monitor.py | 11 +++++------ 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 257cece..e90b876 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,4 @@ conda install -c conda-forge open3d ## TODO -- command_runner中rerun需要更新 -- grid要动态分割大小 -- 任务队列 - 目前obj转osgb的软件windows没有装上,linux成功了,后续需要做一个docker镜像 \ No newline at end of file diff --git a/main.py b/main.py index 2e9f20b..a51cd62 100644 --- a/main.py +++ b/main.py @@ -11,7 +11,7 @@ def parse_args(): # 可选参数 parser.add_argument('--mode', default='重建模式', choices=['快拼模式', '三维模式', '重建模式'], help='处理模式') - parser.add_argument('--grid_size', type=float, default=1000, help='网格大小(米)') + parser.add_argument('--grid_size', type=float, default=800, help='网格大小(米)') parser.add_argument('--grid_overlap', type=float, default=0.05, help='网格重叠率') parser.add_argument('--produce_dem', action='store_true', help='是否生成DEM') diff --git a/odm_preprocess.py b/odm_preprocess.py index 717236f..045565c 100644 --- a/odm_preprocess.py +++ b/odm_preprocess.py @@ -68,7 +68,6 @@ class ImagePreprocessor: config.output_dir, mode=config.mode) self.visualizer = FilterVisualizer(config.output_dir) - # TODO 给出警告! def _clean_output_dir(self): """清理输出目录""" try: diff --git a/post_pro/merge_tif.py b/post_pro/merge_tif.py index c1e005c..210ff9d 100644 --- a/post_pro/merge_tif.py +++ b/post_pro/merge_tif.py @@ -128,6 +128,17 @@ class MergeTif: f"网格 ({grid_id[0]},{grid_id[1]}) 的{product_name}不存在: {grid_tif}") continue + # 如果文件大于600MB,则不使用original文件 + file_size_mb = os.path.getsize(grid_tif) / (1024 * 1024) # 转换为MB + if file_size_mb > 600: + grid_tif = os.path.join( + self.output_dir, + f"grid_{grid_id[0]}_{grid_id[1]}", + "project", + product_path, + "odm_orthophoto.tif" + ) + if input_tif1 is None: input_tif1 = grid_tif self.logger.info(f"设置第一个输入{product_name}: {input_tif1}") diff --git a/utils/odm_monitor.py b/utils/odm_monitor.py index 89a6e68..96ff3d3 100644 --- a/utils/odm_monitor.py +++ b/utils/odm_monitor.py @@ -39,8 +39,8 @@ class ODMProcessMonitor: elif self.mode == "三维模式": # 检查点云和实景三维 if not all([ - os.path.exists(os.path.join(project_dir, 'odm_georeferencing')), - os.path.exists(os.path.join(project_dir, 'odm_texturing')) + os.path.exists(os.path.join(project_dir, 'odm_georeferencing', 'odm_georeferenced_model.laz')), + os.path.exists(os.path.join(project_dir, 'odm_texturing', 'odm_textured_model_geo.obj')) ]): self.logger.error("点云或实景三维文件夹未生成") return False @@ -50,9 +50,8 @@ class ODMProcessMonitor: elif self.mode == "重建模式": # 检查所有产品 if not all([ - os.path.exists(os.path.join(project_dir, 'odm_orthophoto')), - os.path.exists(os.path.join(project_dir, 'odm_georeferencing')), - os.path.exists(os.path.join(project_dir, 'odm_texturing')) + os.path.exists(os.path.join(project_dir, 'odm_georeferencing', 'odm_georeferenced_model.laz')), + os.path.exists(os.path.join(project_dir, 'odm_texturing', 'odm_textured_model_geo.obj')) ]): self.logger.error("部分必要的文件夹未生成") return False @@ -65,6 +64,7 @@ class ODMProcessMonitor: return True + # TODO 正射影像怎么检查最好 def _check_orthophoto(self, project_dir: str) -> bool: """检查正射影像的质量""" ortho_path = os.path.join(project_dir, 'odm_orthophoto', 'odm_orthophoto.original.tif') @@ -197,7 +197,6 @@ class ODMProcessMonitor: else: error_msg = "Docker运行失败,需要人工排查错误" break - # TODO 处理时间组删除,删多了的情况 else: self.logger.info("docker run指令执行成功") if "ODM app finished" in last_lines: