From 6e589d119359868a4ce13da022192f3237d3419c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BE=99=E6=BE=B3?= Date: Fri, 17 Jan 2025 15:36:32 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9A=94=E4=B8=80=E4=B8=AA=E5=88=A0=E4=B8=80?= =?UTF-8?q?=E4=B8=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- odm_preprocess.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/odm_preprocess.py b/odm_preprocess.py index 96e7379..86902b4 100644 --- a/odm_preprocess.py +++ b/odm_preprocess.py @@ -187,6 +187,21 @@ class ImagePreprocessor: self.visualizer.visualize_filter_step( self.gps_points, previous_points, "3-Time Group Overlap") + def filter_alternate_images(self): + """按时间顺序隔一个删一个图像来降低密度""" + previous_points = self.gps_points.copy() + + # 按时间戳排序 + self.gps_points = self.gps_points.sort_values('timestamp') + + # 保留索引为偶数的行(即隔一个保留一个) + self.gps_points = self.gps_points.iloc[::2].reset_index(drop=True) + + self.visualizer.visualize_filter_step( + self.gps_points, previous_points, "4-Alternate Images") + + self.logger.info(f"交替过滤后剩余 {len(self.gps_points)} 个点") + def divide_grids(self) -> Tuple[Dict[tuple, pd.DataFrame], Dict[tuple, tuple]]: """划分网格 Returns: @@ -270,6 +285,7 @@ class ImagePreprocessor: self.cluster() self.filter_isolated_points() self.filter_time_group_overlap() + self.filter_alternate_images() grid_points, translations = self.divide_grids() self.copy_images(grid_points) self.logger.info("预处理任务完成")