1
1
import os
2
+ import argparse
2
3
from Tran_and_scaling .Reput_txt import translate_and_scale_point_cloud
3
4
from Vedio .Semantic_vedio import generate_rotating_point_cloud_video_from_txt
4
5
5
- # 使用示例
6
- input_txt_dir = r"C:\Users\Administrator\Desktop\mp4\other_input\input"
7
- output_dir = r"C:\Users\Administrator\Desktop\mp4\other_input\combine_txt"
8
- output_mp4_dir = rf"C:\Users\Administrator\Desktop\mp4\other_output"
6
+ def main (args ):
7
+ input_txt_dir = args .input_dir
8
+ output_dir = args .output_dir
9
+ output_mp4_dir = args .output_mp4_dir
10
+ overwrite = args .overwrite
9
11
10
- OVERWRITE = False
12
+ # 创建输出目录(如果不存在)
13
+ os .makedirs (output_dir , exist_ok = True )
14
+ os .makedirs (output_mp4_dir , exist_ok = True )
11
15
12
- # 创建输出目录(如果不存在)
13
- os .makedirs (output_dir , exist_ok = True )
14
- os .makedirs (output_mp4_dir , exist_ok = True )
15
-
16
- for filename in os .listdir (input_txt_dir ):
17
- if filename .endswith (".txt" ):
18
- # 构建输入文件路径
19
- input_file = os .path .join (input_txt_dir , filename )
20
- # 调用函数处理点云文件
21
- translate_and_scale_point_cloud (input_file , output_dir , OVERWRITE )
22
- # 构建处理后的txt文件路径
23
- processed_txt = os .path .join (output_dir , filename )
24
- # 调用函数生成旋转点云视频
25
- generate_rotating_point_cloud_video_from_txt (processed_txt , output_mp4_dir , OVERWRITE )
16
+ for filename in os .listdir (input_txt_dir ):
17
+ if filename .endswith (".txt" ):
18
+ # 构建输入文件路径
19
+ input_file = os .path .join (input_txt_dir , filename )
20
+ # 调用函数处理点云文件
21
+ translate_and_scale_point_cloud (input_file , output_dir , overwrite )
22
+ # 构建处理后的txt文件路径
23
+ processed_txt = os .path .join (output_dir , filename )
24
+ # 调用函数生成旋转点云视频
25
+ generate_rotating_point_cloud_video_from_txt (processed_txt , output_mp4_dir , overwrite )
26
26
27
+ if __name__ == "__main__" :
28
+ parser = argparse .ArgumentParser (description = "Process point cloud txt files and generate rotating point cloud videos." )
29
+ parser .add_argument ("--input_dir" , type = str , required = True , help = "Directory containing input txt files." )
30
+ parser .add_argument ("--output_dir" , type = str , required = True , help = "Directory to save processed txt files." )
31
+ parser .add_argument ("--output_mp4_dir" , type = str , required = True , help = "Directory to save generated mp4 videos." )
32
+ parser .add_argument ("--overwrite" , action = "store_true" , help = "Overwrite existing files." )
27
33
34
+ args = parser .parse_args ()
35
+ main (args )
0 commit comments