-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathScaling_finger_Detection.py
83 lines (64 loc) Β· 3.77 KB
/
Scaling_finger_Detection.py
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import cv2
import urllib.request
from cvzone.HandTrackingModule import HandDetector
detector = HandDetector(maxHands=1 , detectionCon=0.8 )
cap = cv2.VideoCapture(0)
while True:
ret, photo = cap.read()
hand = detector.findHands(photo , draw=False )
if hand:
detectHand = hand[0]
if detectHand:
fingerup = detector.fingersUp(detectHand)
if detectHand['type'] == 'Right':
if fingerup == [0, 1, 1, 0, 0]:
print("initial 2 finger : inititaed creating 2 docker containers")
# AI Model
for i in range(2):
request_url = urllib.request.urlopen("https://oh9jhr9pw3.execute-api.ap-south-1.amazonaws.com/test/docker")
print ( request_url.read() )
elif fingerup == [0, 1, 1, 1, 0]:
print("middle 3 finger up : inititaed creating 3 docker containers")
# AI Model
for i in range(3):
request_url = urllib.request.urlopen("https://oh9jhr9pw3.execute-api.ap-south-1.amazonaws.com/test/docker")
print ( request_url.read() )
elif fingerup == [0, 1, 1, 1, 1]:
print("middle 4 finger up : inititaed creating 4 docker containers")
# AI Model
for i in range(4):
request_url = urllib.request.urlopen("https://oh9jhr9pw3.execute-api.ap-south-1.amazonaws.com/test/docker")
print ( request_url.read() )
elif fingerup == [1, 1, 1, 1, 1]:
print("all finger up : inititaed creating 5 docker containers")
for i in range(5):
request_url = urllib.request.urlopen("https://oh9jhr9pw3.execute-api.ap-south-1.amazonaws.com/test/docker")
print ( request_url.read() )
else:
if fingerup == [0, 1, 1, 0, 0]:
print("initial 2 finger : intiated removing 2 docker containers")
# AI Model
for i in range(2):
request_url = urllib.request.urlopen("https://oh9jhr9pw3.execute-api.ap-south-1.amazonaws.com/test/rmvcont")
print ( request_url.read() )
# AI Model
elif fingerup == [0, 1, 1, 1, 0]:
print("middle 3 finger up : intiated removing 3 docker containers")
for i in range(3):
request_url = urllib.request.urlopen("https://oh9jhr9pw3.execute-api.ap-south-1.amazonaws.com/test/rmvcont")
print ( request_url.read() )
elif fingerup == [0, 1, 1, 1, 1]:
print("middle 4 finger up : intiated removing 4 docker containers")
for i in range(4):
request_url = urllib.request.urlopen("https://oh9jhr9pw3.execute-api.ap-south-1.amazonaws.com/test/rmvcont")
print ( request_url.read() )
elif fingerup == [1, 1, 1, 1, 1]:
print("all finger up : intiated removing 5 docker containers")
for i in range(5):
request_url = urllib.request.urlopen("https://oh9jhr9pw3.execute-api.ap-south-1.amazonaws.com/test/rmvcont")
print ( request_url.read() )
cv2.imshow("my photo", photo)
if cv2.waitKey(10) == 13:
break
cv2.destroyAllWindows()
cap.release()