From 39a2e4583fd4b1841c0d71bf34ff8360333051a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BE=99=E6=BE=B3?= Date: Mon, 13 Jan 2025 15:13:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=90=8E=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- post_pro/merge_laz.py | 11 ----------- post_pro/merge_obj.py | 19 ++++++------------- post_pro/merge_tif.py | 11 ----------- 3 files changed, 6 insertions(+), 35 deletions(-) diff --git a/post_pro/merge_laz.py b/post_pro/merge_laz.py index 70cb732..88eaf00 100644 --- a/post_pro/merge_laz.py +++ b/post_pro/merge_laz.py @@ -14,17 +14,6 @@ class MergePly: def merge_grid_laz(self, grid_points: Dict[tuple, pd.DataFrame]): """合并所有网格的点云数据""" - if len(grid_points) == 1: - grid_id = list(grid_points.keys())[0] - shutil.copy2(os.path.join(self.output_dir, - f"grid_{grid_id[0]}_{grid_id[1]}", - "project", - "odm_georeferencing", - "odm_georeferenced_model.laz"), - os.path.join(self.output_dir, - "pointcloud.laz") - ) - try: # 获取所有点云文件路径 laz_files = [] diff --git a/post_pro/merge_obj.py b/post_pro/merge_obj.py index c10813f..45c21e8 100644 --- a/post_pro/merge_obj.py +++ b/post_pro/merge_obj.py @@ -240,12 +240,15 @@ class MergeObj: # 计算新的尺寸(长宽各变为1/4) new_size = (img.shape[1] // 4, img.shape[0] // 4) # 使用双三次插值进行下采样 - resized_img = cv2.resize(img, new_size, interpolation=cv2.INTER_CUBIC) + resized_img = cv2.resize( + img, new_size, interpolation=cv2.INTER_CUBIC) # 保存压缩后的图像 if file.lower().endswith('.png'): - cv2.imwrite(dst_path, resized_img, [cv2.IMWRITE_PNG_COMPRESSION, 9]) + cv2.imwrite(dst_path, resized_img, [ + cv2.IMWRITE_PNG_COMPRESSION, 9]) else: - cv2.imwrite(dst_path, resized_img, [cv2.IMWRITE_JPEG_QUALITY, 95]) + cv2.imwrite(dst_path, resized_img, [ + cv2.IMWRITE_JPEG_QUALITY, 95]) else: self.logger.warning(f"无法读取图像文件: {src_path}") shutil.copy2(src_path, dst_path) @@ -289,16 +292,6 @@ class MergeObj: def merge_grid_obj(self, grid_points: Dict[tuple, pd.DataFrame], translations: Dict[tuple, tuple]): """合并所有网格的OBJ模型""" - if len(grid_points) == 1: - grid_id = list(grid_points.keys())[0] - shutil.copytree(os.path.join(self.output_dir, - f"grid_{grid_id[0]}_{grid_id[1]}", - "project", - "odm_texturing"), - 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")) - try: # 创建输出目录 output_model_dir = os.path.join(self.output_dir, "texturing") diff --git a/post_pro/merge_tif.py b/post_pro/merge_tif.py index 4e42b9f..b5711af 100644 --- a/post_pro/merge_tif.py +++ b/post_pro/merge_tif.py @@ -106,17 +106,6 @@ class MergeTif: self.logger.info(f"开始合并{product_name}") - if len(grid_points) < 2: - grid_id = list(grid_points.keys())[0] - shutil.copy2(os.path.join(self.output_dir, - f"grid_{grid_id[0]}_{grid_id[1]}", - "project", - product_path, - filename), - os.path.join(self.output_dir, - product_info['output']) - ) - input_tif1, input_tif2 = None, None merge_count = 0