Skip to content

Auto scroller Using mediapipe #498

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions scripts/Auto_scroller/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Your Auto Scroller
hey you tired of using your hands and mouse for scroling? <br>
if yes then you are at the right spot here is gift from me to save your hand

## Instructions
make sure you piped all the modules from requirments.txt
<br>
`pip install requirments.txt`
<br>
now run this main.py file in your terminal and use head gestures for scroling
<br>
Author - Saurav Kumar Roy (https://github.com/Sauravroy34)

46 changes: 46 additions & 0 deletions scripts/Auto_scroller/main.finger_scroll.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import mediapipe as mp
import pyautogui as pd
import cv2
height = 480
width = 640




dix =1920
diy =1080
cap = cv2.VideoCapture(0)

while True:
state , frame = cap.read()
frame = cv2.flip(frame,1)
frame = cv2.resize(frame,(640,480))



new_frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
with mp.solutions.hands.Hands(max_num_hands = 1,min_detection_confidence=0.3) as hands:
results = hands.process(new_frame)

if results.multi_hand_landmarks:
for handmarker in results. multi_hand_landmarks:
landmarks = handmarker.landmark[8]

x =int(landmarks.x * 1980)
y =int(landmarks.y * 1100)
z = int(landmarks.z * 100)
if y <400:
pd.scroll(5)

if y >590:
pd.scroll(-5)





cv2.imshow("frame",frame)

if cv2.waitKey(2) & 0xFF == ord("d"):
break
cv2.destroyAllWindows()
58 changes: 58 additions & 0 deletions scripts/Auto_scroller/main_nose_scroll.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import cv2
import mediapipe as mp
import pyautogui as pd


face_mesh = mp.solutions.face_mesh.FaceMesh(max_num_faces=1)

frame_width = 640
frame_height = 480

cap = cv2.VideoCapture(0)

while True:

_, frame = cap.read()

frame = cv2.flip(frame,1)
frame = cv2.resize(frame, (frame_width, frame_height))


new_frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)


output = face_mesh.process(new_frame)
landmarks_points = output.multi_face_landmarks


if landmarks_points:
landmarks = landmarks_points[0].landmark


x = int(landmarks[1].x * frame_width)
y = int(landmarks[1].y * frame_height)
if y < 200:
pd.press("up")
elif y>250:
pd.press("down")
if x > 320:
pd.press("right")


elif x < 180:

pd.press("left")





cv2.imshow("face", frame)


if cv2.waitKey(2) & 0xFF == ord("d"):
break


cap.release()
cv2.destroyAllWindows()
183 changes: 183 additions & 0 deletions scripts/Auto_scroller/requirments.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
absl-py==2.0.0
aiohttp==3.8.5
aiosignal==1.3.1
apturl==0.5.2
asttokens==2.2.1
async-timeout==4.0.3
attrs==23.1.0
backcall==0.2.0
bcrypt==3.2.0
beautifulsoup4==4.12.2
blinker==1.4
boto3==1.28.30
botocore==1.31.30
Brlapi==0.8.3
bs4==0.0.1
caer==2.0.8
certifi==2020.6.20
cffi==1.16.0
chardet==4.0.0
charset-normalizer==3.2.0
click==8.0.3
colorama==0.4.4
comm==0.1.4
command-not-found==0.3
contourpy==1.1.1
cryptography==3.4.8
cupshelpers==1.0
cycler==0.12.0
dataclasses-json==0.5.14
dbus-python==1.2.18
debugpy==1.6.7
decorator==5.1.1
defer==1.0.6
discord==2.3.2
discord.py==2.3.2
distlib==0.3.4
distro==1.7.0
distro-info==1.1+ubuntu0.1
duplicity==0.8.21
EasyProcess==1.1
entrypoint2==1.1
et-xmlfile==1.1.0
exceptiongroup==1.1.3
executing==1.2.0
fasteners==0.14.1
filelock==3.6.0
flatbuffers==23.5.26
fonttools==4.43.1
frozenlist==1.4.0
future==0.18.2
greenlet==2.0.2
httplib2==0.20.2
idna==3.3
importlib-metadata==4.6.4
iniconfig==2.0.0
ipykernel==6.25.0
ipython==8.14.0
jedi==0.19.0
jeepney==0.7.1
jmespath==1.0.1
jupyter_client==8.3.0
jupyter_core==5.3.1
keyring==23.5.0
kiwisolver==1.4.5
langchain==0.0.264
langsmith==0.0.22
language-selector==0.1
launchpadlib==1.10.16
lazr.restfulclient==0.14.4
lazr.uri==1.0.6
lockfile==0.12.2
louis==3.20.0
lxml==4.9.3
macaroonbakery==1.3.1
marshmallow==3.20.1
matplotlib==3.8.0
matplotlib-inline==0.1.6
mediapipe==0.10.5
monotonic==1.6
more-itertools==8.10.0
MouseInfo==0.1.3
mss==9.0.1
multidict==6.0.4
mypy==1.5.1
mypy-extensions==1.0.0
nest-asyncio==1.5.7
netifaces==0.11.0
numexpr==2.8.5
numpy==1.25.2
oauthlib==3.2.0
olefile==0.46
openai==0.27.8
openapi-schema-pydantic==1.2.4
opencv-contrib-python==4.8.1.78
opencv-python==4.8.0.76
openpyxl==3.1.2
packaging==23.1
pandas==2.0.3
paramiko==2.9.3
parso==0.8.3
pexpect==4.8.0
pickleshare==0.7.5
Pillow==10.0.0
pipenv==11.9.0
platformdirs==3.10.0
pluggy==1.2.0
prompt-toolkit==3.0.39
protobuf==3.12.4
psutil==5.9.5
ptyprocess==0.7.0
pure-eval==0.2.2
PyAutoGUI==0.9.54
pycairo==1.20.1
pycparser==2.21
pycryptodome==3.18.0
pycups==2.0.1
pydantic==1.10.12
PyDirectInput==1.0.4
pydirectinput-rgx==2.0.8
PyGetWindow==0.0.9
Pygments==2.15.1
PyGObject==3.42.1
PyJWT==2.3.0
pymacaroons==0.13.0
PyMsgBox==1.0.9
PyNaCl==1.5.0
pyope==0.2.2
pyparsing==2.4.7
PyPDF2==3.0.1
pyperclip==1.8.2
PyRect==0.2.0
pyRFC3339==1.1
pyscreenshot==3.1
PyScreeze==0.1.29
PySide6==6.5.2
PySide6-Addons==6.5.2
PySide6-Essentials==6.5.2
pytest==7.4.0
python-apt==2.4.0+ubuntu2
python-dateutil==2.8.2
python-debian==0.1.43+ubuntu1.1
python-dotenv==1.0.0
python3-xlib==0.15
pytweening==1.0.7
pytz==2022.1
pyxdg==0.27
PyYAML==5.4.1
pyzmq==25.1.0
reportlab==3.6.8
requests==2.25.1
s3transfer==0.6.2
secret==0.8
SecretStorage==3.3.1
shiboken6==6.5.2
six==1.16.0
sounddevice==0.4.6
soupsieve==2.4.1
SQLAlchemy==2.0.19
stack-data==0.6.2
systemd-python==234
tabulate==0.9.0
tenacity==8.2.3
tomli==2.0.1
tornado==6.3.2
tqdm==4.66.1
traitlets==5.9.0
typing-inspect==0.9.0
typing_extensions==4.7.1
tzdata==2023.3
ubuntu-advantage-tools==8001
ubuntu-drivers-common==0.0.0
ufw==0.36.1
unattended-upgrades==0.1
urllib3==1.26.5
usb-creator==0.3.7
virtualenv==20.13.0+ds
virtualenv-clone==0.3.0
wadllib==1.3.6
wcwidth==0.2.6
xdg==5
xkit==0.0.0
yarl==1.9.2
zipp==1.0.0