Posts

Showing posts from August, 2022

EYE CONTROLLED MOUSE

Image
HELLO WORLD;                                                                                (SOURCE CODE BELOW) In this project, we’ll write code to crop images of your eyes each time you click the mouse. Using this data, we can train a model in reverse, predicting the position of the mouse from your eyes.  MODULES NEEDED; GO TO COMMAND PROMPT AND INSTALL THIS MODULES  => pip install PyAutoGUI  => pip install opencv-python => pip install mediapipe *OUTPUT* SOURCE CODE:  import cv2 import mediapipe as mp import pyautogui cam = cv2.VideoCapture( 0 ) face_mesh = mp.solutions.face_mesh.FaceMesh(refine_landmarks= True ) screen_w, screen_h = pyautogui.size() while True :     _, frame = cam.read()     frame = cv2.flip(frame, 1 )     rgb_frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)     output = face_mesh.process(rgb_frame)     landmark_points = output.multi_face_landmarks     frame_h, frame_w, _ = frame.shape     if landmark_points:         landmarks = landmark_points[ 0 ].lan