forked from stevebottos/workout_tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsort_data.py
More file actions
24 lines (18 loc) · 765 Bytes
/
sort_data.py
File metadata and controls
24 lines (18 loc) · 765 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import cv2
import os
input_folder= "unsorted_images/"
out_class1 = "train/class1/" # This class represents the "top" position of a pushup
out_class2 = "train/class2/" # This class represents the "bottom" position of a pushup
out_class3 = "train/class3/" # This class represents anything that doesn't fit in the other two categories
for f in os.listdir(input_folder):
im = cv2.imread(input_folder + f)
cv2.imshow("", im)
opt = cv2.waitKey()
if opt == 49:
cv2.imwrite(out_class1 + str(f) + "_labeled.png", im)
elif opt == 50:
cv2.imwrite(out_class2 + str(f) + "_labeled.png", im)
elif opt == 51:
cv2.imwrite(out_class3 + str(f) + "_labeled.png", im)
os.remove(input_folder + f)
cv2.destroyAllWindows()