-
Notifications
You must be signed in to change notification settings - Fork 3
/
Preprocess.py
56 lines (41 loc) · 1.32 KB
/
Preprocess.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import numpy as np
import cv2
import os
base = 'Worked/'
images = os.listdir(base)
if("Center" not in os.listdir(".")):
os.mkdir("Center")
if("CenterF" not in os.listdir(".")):
os.mkdir("CenterF")
if("Guard" not in os.listdir(".")):
os.mkdir("Guard")
if("GuardF" not in os.listdir(".")):
os.mkdir("GuardF")
if("Forward" not in os.listdir(".")):
os.mkdir("Forward")
if("ForwardC" not in os.listdir(".")):
os.mkdir("ForwardC")
if("ForwardG" not in os.listdir(".")):
os.mkdir("ForwardG")
for image in images:
if(image[:5]=="Guard" and len(image) < 14):
PIL = cv2.imread('Pictures/' + image)
cv2.imwrite('Guard/' + image, PIL)
if(image[:5]=="Guard" and len(image) > 14):
PIL = cv2.imread('Pictures/' + image)
cv2.imwrite('GuardF/' + image, PIL)
if(image[:7]=="Forward" and len(image) < 14):
PIL = cv2.imread('Pictures/' + image)
cv2.imwrite('Forward/' + image, PIL)
if(image[:9]=="Forward-C"):
PIL = cv2.imread('Pictures/' + image)
cv2.imwrite('ForwardC/' + image, PIL)
if(image[:9]=="Forward-G"):
PIL = cv2.imread('Pictures/' + image)
cv2.imwrite('ForwardG/' + image, PIL)
if(image[:6]=="Center" and len(image) < 14):
PIL = cv2.imread('Pictures/' + image)
cv2.imwrite('Center/' + image, PIL)
if(image[:8]=="Center-F"):
PIL = cv2.imread('Pictures/' + image)
cv2.imwrite('CenterF/' + image, PIL)