WalidAlHassan commited on
Commit
b060bfa
·
1 Parent(s): 604bfd6
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ *.psd filter=lfs diff=lfs merge=lfs -text
.idea/.gitignore ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # Default ignored files
2
+ /shelf/
3
+ /workspace.xml
.idea/inspectionProfiles/profiles_settings.xml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ <component name="InspectionProjectProfileManager">
2
+ <settings>
3
+ <option name="USE_PROJECT_PROFILE" value="false" />
4
+ <version value="1.0" />
5
+ </settings>
6
+ </component>
.idea/misc.xml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (pythonProject1)" project-jdk-type="Python SDK" />
4
+ </project>
.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/pythonProject1.iml" filepath="$PROJECT_DIR$/.idea/pythonProject1.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
.idea/pythonProject1.iml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="PYTHON_MODULE" version="4">
3
+ <component name="NewModuleRootManager">
4
+ <content url="file://$MODULE_DIR$">
5
+ <excludeFolder url="file://$MODULE_DIR$/venv" />
6
+ </content>
7
+ <orderEntry type="jdk" jdkName="Python 3.7 (pythonProject1)" jdkType="Python SDK" />
8
+ <orderEntry type="sourceFolder" forTests="false" />
9
+ </component>
10
+ </module>
main.py ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import cv2
2
+ import mediapipe as mp
3
+ import pyautogui
4
+ cap = cv2.VideoCapture(0)
5
+ hand_detector = mp.solutions.hands.Hands()
6
+ drawing_utils = mp.solutions.drawing_utils
7
+ screen_width, screen_height = pyautogui.size()
8
+ index_y = 0
9
+ while True:
10
+ _, frame = cap.read()
11
+ frame = cv2.flip(frame, 1)
12
+ frame_height, frame_width, _ = frame.shape
13
+ rgb_frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
14
+ output = hand_detector.process(rgb_frame)
15
+ hands = output.multi_hand_landmarks
16
+ if hands:
17
+ for hand in hands:
18
+ drawing_utils.draw_landmarks(frame, hand)
19
+ landmarks = hand.landmark
20
+ for id, landmark in enumerate(landmarks):
21
+ x = int(landmark.x*frame_width)
22
+ y = int(landmark.y*frame_height)
23
+ if id == 8:
24
+ cv2.circle(img=frame, center=(x,y), radius=10, color=(0, 255, 255))
25
+ index_x = screen_width/frame_width*x
26
+ index_y = screen_height/frame_height*y
27
+
28
+ if id == 4:
29
+ cv2.circle(img=frame, center=(x,y), radius=10, color=(0, 255, 255))
30
+ thumb_x = screen_width/frame_width*x
31
+ thumb_y = screen_height/frame_height*y
32
+ print('outside', abs(index_y - thumb_y))
33
+ if abs(index_y - thumb_y) < 50:
34
+ pyautogui.click()
35
+ pyautogui.sleep(0.2)
36
+ elif abs(index_y - thumb_y) < 300:
37
+ pyautogui.moveTo(index_x, index_y)
38
+ cv2.imshow('Virtual Mouse', frame)
39
+ cv2.waitKey(1)
requirements.txt ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ absl-py==2.1.0
2
+ attrs==23.2.0
3
+ cffi==1.16.0
4
+ contourpy==1.2.1
5
+ cycler==0.12.1
6
+ flatbuffers==24.3.25
7
+ fonttools==4.53.1
8
+ jax==0.4.30
9
+ jaxlib==0.4.30
10
+ kiwisolver==1.4.5
11
+ matplotlib==3.9.1
12
+ mediapipe==0.10.14
13
+ ml-dtypes==0.4.0
14
+ MouseInfo==0.1.3
15
+ numpy==2.0.0
16
+ opencv-contrib-python==4.10.0.84
17
+ opencv-python==4.10.0.84
18
+ opt-einsum==3.3.0
19
+ packaging==24.1
20
+ pillow==10.4.0
21
+ protobuf==4.25.3
22
+ PyAutoGUI==0.9.54
23
+ pycparser==2.22
24
+ PyGetWindow==0.0.9
25
+ PyMsgBox==1.0.9
26
+ pyparsing==3.1.2
27
+ pyperclip==1.9.0
28
+ PyRect==0.2.0
29
+ PyScreeze==0.1.30
30
+ python-dateutil==2.9.0.post0
31
+ pytweening==1.2.0
32
+ scipy==1.14.0
33
+ setuptools==69.5.1
34
+ shapely==2.0.3
35
+ six==1.16.0
36
+ sounddevice==0.4.7
37
+ wheel==0.43.0