(self, p1, p2, img, draw=True, r=15, t=3)
| 89 | return fingers |
| 90 | |
| 91 | def findDistance(self, p1, p2, img, draw=True, r=15, t=3): |
| 92 | x1, y1 = self.lmList[p1][1:] |
| 93 | x2, y2 = self.lmList[p2][1:] |
| 94 | cx, cy = (x1 + x2) // 2, (y1 + y2) // 2 |
| 95 | |
| 96 | if draw: |
| 97 | cv2.line(img, (x1, y1), (x2, y2), (255, 0, 255), t) |
| 98 | cv2.circle(img, (x1, y1), r, (255, 0, 255), cv2.FILLED) |
| 99 | cv2.circle(img, (x2, y2), r, (255, 0, 255), cv2.FILLED) |
| 100 | cv2.circle(img, (cx, cy), r, (0, 0, 255), cv2.FILLED) |
| 101 | length = math.hypot(x2 - x1, y2 - y1) |
| 102 | |
| 103 | return length, img, [x1, y1, x2, y2, cx, cy] |
| 104 | |
| 105 | |
| 106 | def main(): |
no outgoing calls
no test coverage detected