-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathphysiotherapyAssessment.py
More file actions
34 lines (26 loc) · 1.45 KB
/
physiotherapyAssessment.py
File metadata and controls
34 lines (26 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import poseDetector as ps
class shoulderAssessment():
def __init__(self, landmarks={}, scale=1.0):
self.landmarks = landmarks
self.scale = scale
class shoulderAROM():
def __init__(self, landmarks={}, scale=1.0):
self.landmarks = landmarks
self.scale = scale
def elevAbduction(self):
model = ps.poseDetector()
leftShoulderAngle = model.getAngle(self.landmarks["LEFT_ELBOW"], self.landmarks["LEFT_SHOULDER"], self.landmarks["LEFT_HIP"])
leftElbowAngle = model.getAngle(self.landmarks["LEFT_SHOULDER"], self.landmarks["LEFT_ELBOW"], self.landmarks["LEFT_WRIST"])
scores = {}
scores["leftElbowScore"] = leftElbowAngle
scores["leftShoulderScore"] = leftShoulderAngle
rightShoulderAngle = model.getAngle(self.landmarks["RIGHT_ELBOW"], self.landmarks["RIGHT_SHOULDER"], self.landmarks["RIGHT_HIP"])
rightElbowAngle = model.getAngle(self.landmarks["RIGHT_SHOULDER"], self.landmarks["RIGHT_ELBOW"], self.landmarks["RIGHT_WRIST"])
scores["rightElbowScore"] = rightElbowAngle
scores["rightShoulderScore"] = rightShoulderAngle
scores["avgScore"] = sum(scores.values())/(len(scores))
return(scores)
def getScoreList(self):
arom = self.shoulderAROM(self.landmarks, self.scale)
score = arom.elevAbduction()
return score