Skip to content
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

Reference Relative OpenCV Paths #4

Merged
merged 1 commit into from
Oct 9, 2022
Merged
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
15 changes: 6 additions & 9 deletions eye_Controlled_Mouse.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
import cv2
from pynput.mouse import Button,Controller

import os

mouse = Controller()
eye_Cascade_File = cv2.CascadeClassifier('C:\\Users\\Vishal\\AppData\Local\\Programs\\Python\\Python36-32'
'\\opencv_python-3.3.0.10.dist-info\\data\\haarcascades\\haarcascade_eye.xml')
face_Cascade_File = cv2.CascadeClassifier('C:\\Users\\Vishal\\AppData\\Local\\Programs'
'\\Python\\Python36-32\\opencv_python-3.3.0.10.dist-info'
'\\data\\haarcascades\\haarcascade_frontalface_default.xml')
eye_Cascade_File = cv2.CascadeClassifier(os.path.dirname(cv2.__file__) + '/data/haarcascade_eye.xml')
face_Cascade_File = cv2.CascadeClassifier(os.path.dirname(cv2.__file__) + '/data/haarcascade_frontalface_default.xml')

cam = cv2.VideoCapture(0)


def track_pupil():
#zooming and tracking pupil movement
pass




while True:
global a,b
a,b = 0,0
ret, img = cam.read()
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) # convering to gray to recognize colour change effectively
faces = face_Cascade_File.detectMultiScale(gray, 1.3, 5) # geometry
Expand All @@ -39,12 +38,10 @@ def track_pupil():
b=int(float(ey)/8)
if int(len(eyes)) == 0:
quit()

cv2.imshow('img', img)
mouse.move(a,b)
k = cv2.waitKey(30) & 0xff


if (k == 27):
break

Expand Down