Skip to content
Snippets Groups Projects
Commit 2262514f authored by computervisiondeveloper's avatar computervisiondeveloper
Browse files

Edit data creation to improve robustness.

parent c90bc753
No related branches found
No related tags found
No related merge requests found
......@@ -19,6 +19,10 @@ labels = []
for dir_ in os.listdir(DATA_DIR):
for img_path in os.listdir(os.path.join(DATA_DIR, dir_)):
data_aux = []
x_ = []
y_ = []
img = cv2.imread(os.path.join(DATA_DIR, dir_, img_path))
img_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
......@@ -28,8 +32,15 @@ for dir_ in os.listdir(DATA_DIR):
for i in range(len(hand_landmarks.landmark)):
x = hand_landmarks.landmark[i].x
y = hand_landmarks.landmark[i].y
data_aux.append(x)
data_aux.append(y)
x_.append(x)
y_.append(y)
for i in range(len(hand_landmarks.landmark)):
x = hand_landmarks.landmark[i].x
y = hand_landmarks.landmark[i].y
data_aux.append(x - min(x_))
data_aux.append(y - min(y_))
data.append(data_aux)
labels.append(dir_)
......
......@@ -42,11 +42,16 @@ while True:
for i in range(len(hand_landmarks.landmark)):
x = hand_landmarks.landmark[i].x
y = hand_landmarks.landmark[i].y
data_aux.append(x)
data_aux.append(y)
x_.append(x)
y_.append(y)
for i in range(len(hand_landmarks.landmark)):
x = hand_landmarks.landmark[i].x
y = hand_landmarks.landmark[i].y
data_aux.append(x - min(x_))
data_aux.append(y - min(y_))
x1 = int(min(x_) * W) - 10
y1 = int(min(y_) * H) - 10
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment