From 382a269831e5c5cc29a1861325becdf362fd3e6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BE=99=E6=BE=B3?= Date: Thu, 9 Jan 2025 19:32:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A3=80=E6=B5=8B=E6=88=90?= =?UTF-8?q?=E5=8A=9F=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/odm_monitor.py | 54 +++++++++++++++++++++++++++++++++----------- 1 file changed, 41 insertions(+), 13 deletions(-) diff --git a/utils/odm_monitor.py b/utils/odm_monitor.py index 0eabeb4..89a6e68 100644 --- a/utils/odm_monitor.py +++ b/utils/odm_monitor.py @@ -25,22 +25,50 @@ class ODMProcessMonitor: """检查ODM是否执行成功 检查项目: - 1. 必要的文件夹是否存在 - 2. 正射影像是否生成且有效 - 3. 正射影像文件大小是否正常 + 1. 必要的文件夹和文件是否存在 + 2. 产品文件是否有效 """ - # 检查必要文件夹 - success_markers = ['odm_orthophoto'] - if self.mode != "快拼模式": - success_markers.extend(['odm_texturing', 'odm_georeferencing']) + project_dir = os.path.join(grid_dir, 'project') + + # 根据不同模式检查不同的产品 + if self.mode == "快拼模式": + # 只检查正射影像 + if not self._check_orthophoto(project_dir): + return False + + 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')) + ]): + self.logger.error("点云或实景三维文件夹未生成") + return False + + # TODO: 添加点云和实景三维的质量检查 + + 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')) + ]): + self.logger.error("部分必要的文件夹未生成") + return False + + # 检查正射影像 + if not self._check_orthophoto(project_dir): + return False + + # TODO: 添加点云和实景三维的质量检查 - if not all(os.path.exists(os.path.join(grid_dir, 'project', marker)) for marker in success_markers): - self.logger.error("必要的文件夹未生成") - return False + return True - # 检查正射影像文件 - ortho_path = os.path.join( - grid_dir, 'project', 'odm_orthophoto', 'odm_orthophoto.original.tif') + def _check_orthophoto(self, project_dir: str) -> bool: + """检查正射影像的质量""" + ortho_path = os.path.join(project_dir, 'odm_orthophoto', 'odm_orthophoto.original.tif') + if not os.path.exists(ortho_path): self.logger.error("正射影像文件未生成") return False