From cc7a1456e020af07a7deafd96748adfd3f119be2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BE=99=E6=BE=B3?= Date: Mon, 20 Jan 2025 21:05:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0obj=E8=BD=AC=E6=8D=A2osgb?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- odm_preprocess.py | 2 +- odm_preprocess_fast.py | 2 +- post_pro/merge_obj.py | 24 ++++++++++++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/odm_preprocess.py b/odm_preprocess.py index b3015c0..cc86c04 100644 --- a/odm_preprocess.py +++ b/odm_preprocess.py @@ -325,7 +325,7 @@ if __name__ == "__main__": grid_overlap=0.05, - mode="快拼模式", + mode="重建模式", produce_dem=False, ) diff --git a/odm_preprocess_fast.py b/odm_preprocess_fast.py index 7228537..d97a795 100644 --- a/odm_preprocess_fast.py +++ b/odm_preprocess_fast.py @@ -309,7 +309,7 @@ if __name__ == "__main__": grid_overlap=0.05, - mode="快拼模式", + mode="重建模式", produce_dem=False, ) diff --git a/post_pro/merge_obj.py b/post_pro/merge_obj.py index 89c68ca..8d52841 100644 --- a/post_pro/merge_obj.py +++ b/post_pro/merge_obj.py @@ -6,6 +6,7 @@ import pandas as pd import shutil import time import cv2 +import subprocess class MergeObj: @@ -301,6 +302,17 @@ class MergeObj: os.path.join(self.output_dir, "texturing")) os.rename(os.path.join(self.output_dir, "texturing", "odm_textured_model_geo.obj"), os.path.join(self.output_dir, "texturing", "textured_model.obj")) + self.logger.info(f"开始执行格式转换") + docker_command = ( + f"docker run --rm -it " + f"-v {self.output_dir}/texturing:/data " + f"-e LD_LIBRARY_PATH=/opt/osg/build/lib:$LD_LIBRARY_PATH " + f"osg-ubuntu2004 osgconv /data/textured_model.obj /data/textured_model.osgb" + ) + self.logger.info(docker_command) + subprocess.run( + docker_command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + self.logger.info(f"格式转换完成") return try: @@ -414,6 +426,18 @@ class MergeObj: f"- 纹理文件: {len(os.listdir(output_model_dir)) - 2}个" ) + self.logger.info(f"开始执行格式转换") + docker_command = ( + f"docker run --rm -it " + f"-v {self.output_model_dir}:/data " + f"-e LD_LIBRARY_PATH=/opt/osg/build/lib:$LD_LIBRARY_PATH " + f"osg-ubuntu2004 osgconv /data/textured_model.obj /data/textured_model.osgb" + ) + self.logger.info(docker_command) + subprocess.run( + docker_command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + self.logger.info(f"格式转换完成") + except Exception as e: self.logger.error(f"合并过程中发生错误: {str(e)}", exc_info=True) raise