MCPcopy Create free account
hub / github.com/alpha2phi/python-apps / calculate_angle

Function calculate_angle

computer-vision/curl_counter.py:15–28  ·  view source on GitHub ↗
(a, b, c)

Source from the content-addressed store, hash-verified

13
14
15def calculate_angle(a, b, c):
16 a = np.array(a) # First
17 b = np.array(b) # Mid
18 c = np.array(c) # End
19
20 radians = np.arctan2(c[1] - b[1], c[0] - b[0]) - np.arctan2(
21 a[1] - b[1], a[0] - b[0]
22 )
23 angle = np.abs(radians * 180.0 / np.pi)
24
25 if angle > 180.0:
26 angle = 360 - angle
27
28 return angle
29
30
31# Setup mediapipe instance

Callers 1

curl_counter.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected