规范代码格式
This commit is contained in:
parent
9e30a58fa9
commit
e9cd12b2f6
@ -64,8 +64,8 @@ class ImagePreprocessor:
|
|||||||
self.logger.info("开始过滤GPS点")
|
self.logger.info("开始过滤GPS点")
|
||||||
filter = GPSFilter(self.config.output_dir)
|
filter = GPSFilter(self.config.output_dir)
|
||||||
|
|
||||||
self.logger.info(f"开始过滤孤立点 (距离阈值: {self.config.filter_distance_threshold}, 最小邻居数: {
|
self.logger.info(
|
||||||
self.config.filter_min_neighbors})")
|
f"开始过滤孤立点(距离阈值: {self.config.filter_distance_threshold}, 最小邻居数: {self.config.filter_min_neighbors})")
|
||||||
self.gps_points = filter.filter_isolated_points(
|
self.gps_points = filter.filter_isolated_points(
|
||||||
self.gps_points,
|
self.gps_points,
|
||||||
self.config.filter_distance_threshold,
|
self.config.filter_distance_threshold,
|
||||||
@ -73,8 +73,8 @@ class ImagePreprocessor:
|
|||||||
)
|
)
|
||||||
self.logger.info(f"孤立点过滤后剩余 {len(self.gps_points)} 个GPS点")
|
self.logger.info(f"孤立点过滤后剩余 {len(self.gps_points)} 个GPS点")
|
||||||
|
|
||||||
self.logger.info(f"开始过滤密集点 (网格大小: {self.config.filter_grid_size}, 距离阈值: {
|
self.logger.info(
|
||||||
self.config.filter_dense_distance_threshold})")
|
f"开始过滤密集点(网格大小: {self.config.filter_grid_size}, 距离阈值: {self.config.filter_dense_distance_threshold})")
|
||||||
self.gps_points = filter.filter_dense_points(
|
self.gps_points = filter.filter_dense_points(
|
||||||
self.gps_points,
|
self.gps_points,
|
||||||
grid_size=self.config.filter_grid_size,
|
grid_size=self.config.filter_grid_size,
|
||||||
@ -90,7 +90,8 @@ class ImagePreprocessor:
|
|||||||
|
|
||||||
self.logger.info(f"开始划分网格 (重叠率: {self.config.grid_overlap})")
|
self.logger.info(f"开始划分网格 (重叠率: {self.config.grid_overlap})")
|
||||||
grid_divider = GridDivider(overlap=self.config.grid_overlap)
|
grid_divider = GridDivider(overlap=self.config.grid_overlap)
|
||||||
grids = grid_divider.divide_grids(self.gps_points, grid_size=self.config.grid_size)
|
grids = grid_divider.divide_grids(
|
||||||
|
self.gps_points, grid_size=self.config.grid_size)
|
||||||
grid_points = grid_divider.assign_to_grids(self.gps_points, grids)
|
grid_points = grid_divider.assign_to_grids(self.gps_points, grids)
|
||||||
self.logger.info(f"成功划分为 {len(grid_points)} 个网格")
|
self.logger.info(f"成功划分为 {len(grid_points)} 个网格")
|
||||||
return grid_points
|
return grid_points
|
||||||
@ -104,9 +105,11 @@ class ImagePreprocessor:
|
|||||||
|
|
||||||
for grid_idx, points in grid_points.items():
|
for grid_idx, points in grid_points.items():
|
||||||
if self.config.enable_grid_division:
|
if self.config.enable_grid_division:
|
||||||
output_dir = os.path.join(self.config.output_dir, f'grid_{grid_idx + 1}', 'project', 'images')
|
output_dir = os.path.join(
|
||||||
|
self.config.output_dir, f'grid_{grid_idx + 1}', 'project', 'images')
|
||||||
else:
|
else:
|
||||||
output_dir = os.path.join(self.config.output_dir, 'project', 'images')
|
output_dir = os.path.join(
|
||||||
|
self.config.output_dir, 'project', 'images')
|
||||||
|
|
||||||
os.makedirs(output_dir, exist_ok=True)
|
os.makedirs(output_dir, exist_ok=True)
|
||||||
|
|
||||||
@ -140,7 +143,8 @@ class ImagePreprocessor:
|
|||||||
alpha=0.6)
|
alpha=0.6)
|
||||||
|
|
||||||
# 绘制被过滤的点
|
# 绘制被过滤的点
|
||||||
filtered_points_df = original_points_df[original_points_df['file'].isin(filtered_files)]
|
filtered_points_df = original_points_df[original_points_df['file'].isin(
|
||||||
|
filtered_files)]
|
||||||
plt.scatter(filtered_points_df['lon'],
|
plt.scatter(filtered_points_df['lon'],
|
||||||
filtered_points_df['lat'],
|
filtered_points_df['lat'],
|
||||||
color="red",
|
color="red",
|
||||||
@ -181,8 +185,8 @@ class ImagePreprocessor:
|
|||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# 创建配置
|
# 创建配置
|
||||||
config = PreprocessConfig(
|
config = PreprocessConfig(
|
||||||
image_dir=r'C:\datasets\1815\images',
|
image_dir=r'E:\datasets\UAV\1815',
|
||||||
output_dir=r'C:\datasets\1815\output',
|
output_dir=r'E:\datasets\UAV\1815\output',
|
||||||
filter_grid_size=0.001,
|
filter_grid_size=0.001,
|
||||||
filter_dense_distance_threshold=10,
|
filter_dense_distance_threshold=10,
|
||||||
filter_distance_threshold=0.001,
|
filter_distance_threshold=0.001,
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
preprocess/__pycache__/time_filter.cpython-39.pyc
Normal file
BIN
preprocess/__pycache__/time_filter.cpython-39.pyc
Normal file
Binary file not shown.
@ -4,6 +4,7 @@ import subprocess
|
|||||||
from typing import Dict
|
from typing import Dict
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
|
||||||
|
|
||||||
class CommandRunner:
|
class CommandRunner:
|
||||||
"""执行网格处理命令的类"""
|
"""执行网格处理命令的类"""
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user