This commit is contained in:
DuOtto
2025-11-04 21:40:06 +01:00
parent 1d63671fad
commit 225ecc2e17
16 changed files with 244 additions and 109 deletions
+15
View File
@@ -1,6 +1,21 @@
import numpy as np
import cv2
# ----- Helper Functions -----
def compute_distance(p1, p2):
return np.hypot(p2[0] - p1[0], p2[1] - p1[1])
# 4) compute straightness per finger
def finger_straight(i_tip, i_pip, i_mcp):
d1 = np.hypot(*(np.array(i_tip)-np.array(i_pip)))
d2 = np.hypot(*(np.array(i_pip)-np.array(i_mcp)))
return float(np.clip(d1/(d2+1e-3), 0, 1))
def yes_no():
while True:
key = cv2.waitKey(1) & 0xFF
if key == ord("y"):
return True
if key == ord("n"):
return False