44 lines
1.4 KiB
Python
44 lines
1.4 KiB
Python
import os
|
|
import shutil
|
|
|
|
def clean_scene_data(root, scene):
|
|
# 清理目标点云数据
|
|
pts_dir = os.path.join(root, scene, "pts")
|
|
if os.path.exists(pts_dir):
|
|
shutil.rmtree(pts_dir)
|
|
print(f"已删除 {pts_dir}")
|
|
|
|
# 清理法线数据
|
|
nrm_dir = os.path.join(root, scene, "nrm")
|
|
if os.path.exists(nrm_dir):
|
|
shutil.rmtree(nrm_dir)
|
|
print(f"已删除 {nrm_dir}")
|
|
|
|
# 清理扫描点索引数据
|
|
scan_points_indices_dir = os.path.join(root, scene, "scan_points_indices")
|
|
if os.path.exists(scan_points_indices_dir):
|
|
shutil.rmtree(scan_points_indices_dir)
|
|
print(f"已删除 {scan_points_indices_dir}")
|
|
|
|
# 删除扫描点数据文件
|
|
scan_points_file = os.path.join(root, scene, "scan_points.txt")
|
|
if os.path.exists(scan_points_file):
|
|
os.remove(scan_points_file)
|
|
print(f"已删除 {scan_points_file}")
|
|
|
|
def clean_all_scenes(root, scene_list):
|
|
for idx, scene in enumerate(scene_list):
|
|
print(f"正在清理场景 {scene} ({idx+1}/{len(scene_list)})")
|
|
clean_scene_data(root, scene)
|
|
|
|
if __name__ == "__main__":
|
|
root = r"c:\Document\Local Project\nbv_rec\nbv_reconstruction\temp"
|
|
scene_list = os.listdir(root)
|
|
from_idx = 0
|
|
to_idx = len(scene_list)
|
|
print(f"正在清理场景 {scene_list[from_idx:to_idx]}")
|
|
|
|
clean_all_scenes(root, scene_list[from_idx:to_idx])
|
|
print("清理完成")
|
|
|