UAV/main.py
2025-01-09 11:45:55 +08:00

50 lines
1.7 KiB
Python

import argparse
from datetime import timedelta
from odm_preprocess import PreprocessConfig, ImagePreprocessor
def parse_args():
parser = argparse.ArgumentParser(description='ODM预处理工具')
# 必需参数
parser.add_argument('--image_dir', required=True, help='输入图片目录路径')
parser.add_argument('--output_dir', required=True, help='输出目录路径')
# 可选参数
parser.add_argument('--mode', default='重建模式', choices=['快拼模式', '三维模式', '重建模式'], help='处理模式')
parser.add_argument('--grid_size', type=float, default=1000, help='网格大小(米)')
parser.add_argument('--grid_overlap', type=float, default=0.05, help='网格重叠率')
parser.add_argument('--produce_dem', action='store_true', help='是否生成DEM')
args = parser.parse_args()
return args
def main():
args = parse_args()
# 创建配置
config = PreprocessConfig(
image_dir=args.image_dir,
output_dir=args.output_dir,
mode=args.mode,
grid_size=args.grid_size,
grid_overlap=args.grid_overlap,
produce_dem=args.produce_dem,
# 其他参数使用默认值
cluster_eps=0.01,
cluster_min_samples=5,
time_group_overlap_threshold=0.7,
time_group_interval=timedelta(minutes=5),
filter_distance_threshold=0.001,
filter_min_neighbors=6,
filter_grid_size=0.001,
filter_dense_distance_threshold=10,
filter_time_threshold=timedelta(minutes=5),
)
# 创建处理器并执行
processor = ImagePreprocessor(config)
processor.process()
if __name__ == '__main__':
main()