-
Notifications
You must be signed in to change notification settings - Fork 0
/
calib_order_tool.py
36 lines (33 loc) · 1.51 KB
/
calib_order_tool.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import os
# The starting number for the increment
folderName = "./measurementsMireHorizontale"
# The starting number for the increment
start = 1
deleted_indices = []
for i in range(1, 50):
yaml_file = os.path.join(folderName, f"pose_cPo_{i}.yaml")
if os.path.exists(yaml_file):
# Rename the image, configuration, pose_fPe, and pose_cPo files to reflect the increment
image_file = os.path.join(folderName, f"image-{i}.png")
os.rename(image_file, os.path.join(folderName, f"image-{start}.png"))
configuration_file = os.path.join(folderName, f"configuration_{i}")
os.rename(configuration_file, os.path.join(folderName, f"configuration_{start}"))
pose_fPe_file = os.path.join(folderName, f"pose_fPe_{i}.yaml")
os.rename(pose_fPe_file, os.path.join(folderName, f"pose_fPe_{start}.yaml"))
os.rename(yaml_file, os.path.join(folderName, f"pose_cPo_{start}.yaml"))
start += 1
else:
# Delete the corresponding image, configuration, and pose_fPe files
image_file = os.path.join(folderName, f"image-{i}.png")
os.remove(image_file)
deleted_indices.append(i)
configuration_file = os.path.join(folderName, f"configuration_{i}")
os.remove(configuration_file)
deleted_indices.append(i)
pose_fPe_file = os.path.join(folderName, f"pose_fPe_{i}.yaml")
os.remove(pose_fPe_file)
deleted_indices.append(i)
# Print the deleted indices
print("Deleted indices:")
for index in deleted_indices:
print(index)