-
Notifications
You must be signed in to change notification settings - Fork 0
/
vod_sort_training_images.py
52 lines (44 loc) · 1.52 KB
/
vod_sort_training_images.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
import os
import cv2
directory = './data/unsorted/'
for filename in os.listdir(directory):
# Skip the git ignore file
if (filename == '.gitignore'): continue
f = os.path.join(directory, filename)
# checking if it is a file
if os.path.isfile(f):
image = cv2.imread(f)
image_big = cv2.resize(image, (image.shape[1]*3, image.shape[0]*3), interpolation=cv2.INTER_LINEAR)
cv2.imshow('image', image_big)
key_press = cv2.waitKey(0)
cv2.destroyWindow('image')
# r = Raze
# o = Omen
# s = Skye
# k = Killjoy
# b = Breach
#
identified_feature = None
if (key_press == 27): # If we press escape, get out
break
elif (key_press == 32):
identified_feature = 'spike'
elif (key_press == ord('r')):
identified_feature = 'raze'
elif (key_press == ord('o')):
identified_feature = 'omen'
elif (key_press == ord('s')):
identified_feature = 'skye'
elif (key_press == ord('k')):
identified_feature = 'killjoy'
elif (key_press == ord('b')):
identified_feature = 'breach'
else:
continue
newpath = './data/sorted/'+str(identified_feature)+'/'
if not os.path.exists(newpath):
os.makedirs(newpath)
output_filename = newpath+str(hash(filename))+'.png'
os.remove(f)
cv2.imwrite(output_filename, image)
cv2.destroyAllWindows()