43 lines
985 B
Python
43 lines
985 B
Python
import json
|
|
import pickle
|
|
import time
|
|
|
|
import cv2
|
|
import numpy as np
|
|
|
|
import utils
|
|
from draw import draw_new
|
|
|
|
moves = []
|
|
better_moves = {}
|
|
|
|
with open('moves.pkl', 'rb') as f: # 'rb' = read binary
|
|
moves = pickle.load(f)
|
|
|
|
startValue = moves[0][0]
|
|
totalCount = len(moves)
|
|
|
|
for i, move in enumerate(moves):
|
|
moves[i] = (move[0] - startValue, move[1], move[2])
|
|
|
|
# left_hip = move[2][11] # Left Hip
|
|
# right_hip = move[2][12] # Right Hip
|
|
# center = (left_hip + right_hip) / 2
|
|
#
|
|
# # Normalizacja względem środka ciała
|
|
# normalized_keypoints = move[2] - center
|
|
#
|
|
# better_moves[round((move[0] - startValue) * 1000)] = normalized_keypoints.tolist()
|
|
#
|
|
# # scale = utils.distance(move[2][11], move[2][12])
|
|
# # print(scale)
|
|
# draw = normalized_keypoints + 200
|
|
|
|
|
|
# Do rysowania (np. przesunięcie na ekran)
|
|
draw = utils.normalize(move[2]) * 200 + 250
|
|
|
|
cv2.imshow('you', draw_new(draw))
|
|
cv2.waitKey(1)
|
|
time.sleep(0.1)
|