|
|
|
@ -143,22 +143,32 @@ class SpecialGestureDetector:
|
|
|
|
|
|
|
|
|
|
|
|
# ---- ЛАДОШКА ----
|
|
|
|
# ---- ЛАДОШКА ----
|
|
|
|
|
|
|
|
|
|
|
|
r_sh_z = landmarks[idx['right_shoulder']][2]
|
|
|
|
#r_sh_z = landmarks[idx['right_shoulder']][2]
|
|
|
|
r_wr_z = landmarks[idx['right_wrist']][2]
|
|
|
|
#r_wr_z = landmarks[idx['right_wrist']][2]
|
|
|
|
r_el_z = landmarks[idx['right_elbow']][2]
|
|
|
|
#r_el_z = landmarks[idx['right_elbow']][2]
|
|
|
|
#1. правая рука почти выпрямлена
|
|
|
|
##1. правая рука почти выпрямлена
|
|
|
|
wrist_at_shoulder_y = abs(r_wr[1] - r_sh[1]) < 0.4 * torso_height
|
|
|
|
#wrist_at_shoulder_y = abs(r_wr[1] - r_sh[1]) < 0.4 * torso_height
|
|
|
|
wrist_at_shoulder_x = abs(r_wr[0] - r_sh[0]) < 0.5 * shoulder_width
|
|
|
|
#wrist_at_shoulder_x = abs(r_wr[0] - r_sh[0]) < 0.5 * shoulder_width
|
|
|
|
|
|
|
|
|
|
|
|
r_sh_z_divided = (landmarks[12][2] + landmarks[11][2])/2
|
|
|
|
#r_sh_z_divided = (landmarks[12][2] + landmarks[11][2])/2
|
|
|
|
nose_z = landmarks[0][2]
|
|
|
|
#nose_z = landmarks[0][2]
|
|
|
|
nose_and_sh_distance = r_sh_z_divided - nose_z
|
|
|
|
#nose_and_sh_distance = r_sh_z_divided - nose_z
|
|
|
|
|
|
|
|
|
|
|
|
arm_forward = r_sh_z - r_wr_z
|
|
|
|
#arm_forward = r_sh_z - r_wr_z
|
|
|
|
|
|
|
|
|
|
|
|
print(f"arm_forward = {round(arm_forward, 3)} and nose_and_sh_distance = {round(nose_and_sh_distance, 3)}")
|
|
|
|
#print(f"arm_forward = {round(arm_forward, 3)} and nose_and_sh_distance = {round(nose_and_sh_distance, 3)}")
|
|
|
|
if wrist_at_shoulder_y and wrist_at_shoulder_x and (arm_forward > 3.5*nose_and_sh_distance):
|
|
|
|
#if wrist_at_shoulder_y and wrist_at_shoulder_x and (arm_forward > 3.5*nose_and_sh_distance):
|
|
|
|
return "ladoshka"
|
|
|
|
#return "ladoshka"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ---- Рука к носу ----
|
|
|
|
|
|
|
|
nose_x = landmarks[0][0]
|
|
|
|
|
|
|
|
nose_y = landmarks[0][1]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wrist_at_nose_x = abs(r_wr[0] - nose_x) < 0.5 * shoulder_width
|
|
|
|
|
|
|
|
wrist_at_nose_y = abs(r_wr[1] - nose_y) < 0.2 * torso_height
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if wrist_at_nose_x and wrist_at_nose_y:
|
|
|
|
|
|
|
|
return "kulak-nos"
|
|
|
|
|
|
|
|
|
|
|
|
return 'none'
|
|
|
|
return 'none'
|
|
|
|
|