-
Notifications
You must be signed in to change notification settings - Fork 102
/
Copy pathreordering.py
36 lines (26 loc) · 1.07 KB
/
reordering.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
def readinput (path):
inputList=sorted([f for f in os.listdir(path)])
maxLength=max(len(infile) for infile in inputList)
minLength=min(len(infile) for infile in inputList)
# print(inputList)
# print("maxLength {: }".format(maxLength))
# print("minLength {: }".format(minLength))
if maxLength == minLength:
seqList=[path + infile for infile in inputList]
else:
# special designed condition for casme2 dB, SMIC should not be involved
tempList=[]
for index in inputList:
if len(index) == 12:
tempVidName=int(index[-5:-4])
elif len(index) == 13:
tempVidName=int(index[-6:-4])
elif len(index) == 14:
tempVidName=int(index[-7:-4])
else:
print ("Exceed the predefined range!")
tempList.append(tempVidName)
tempList=sorted(tempList)
seqList=[path + 'reg_img' + str(infile) + '.jpg' for infile in tempList]
return seqList