forked from ArhumS/Underwater-world
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvalidate_pairs.py
36 lines (27 loc) · 1.11 KB
/
validate_pairs.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 sys
from get_monocular import get_monocular
import numpy as np
def validate_pairs(directory, width = 4):
""" this function validates the directory structure """
left = get_monocular(directory, 'frame_*/left.jpg')
right = get_monocular(directory, 'frame_*/right.jpg')
if len(left) != len(right):
print(f"left length {len(left)} right length {len(right)}")
return False
for counter, l, r in zip(range(1,len(left)+1),left,right):
# print(f" counter {counter} left {l} right {r}")
numstring = format(counter, '0'+ str(width))
left_name = f"{directory}/frame_{numstring}/left.jpg"
right_name = f"{directory}/frame_{numstring}/right.jpg"
if left_name != l:
print(f"left {left_name} != {l}")
return False
if right_name != r:
print(f"right {right_name} != {r}")
return False
return True
if __name__ == "__main__":
if len(sys.argv) == 2:
print(validate_pairs(sys.argv[1]))
else:
print('Usage : python3 validate_pairs.py directory')