|
| 1 | +import face_recognition |
| 2 | +import cv2 |
| 3 | +import numpy as qt |
| 4 | +import pyautogui |
| 5 | +from selenium import webdriver |
| 6 | +import time |
| 7 | +import os |
| 8 | + |
| 9 | + |
| 10 | +gmail = "ENTER GMAIL HERE" |
| 11 | +password = "ENTER PASSWORD HERE" |
| 12 | + |
| 13 | +video_capture = cv2.VideoCapture(0) |
| 14 | + |
| 15 | +root_image = face_recognition.load_image_file("YOUR PHOTO PATH") |
| 16 | +root_encoding = face_recognition.face_encodings(root_image)[0] |
| 17 | + |
| 18 | + |
| 19 | +known_face_encodings = [ |
| 20 | + root_encoding, |
| 21 | +] |
| 22 | +known_face_names = [ |
| 23 | + "YOUR NAME", |
| 24 | +] |
| 25 | + |
| 26 | +while True: |
| 27 | + ret, frame = video_capture.read() |
| 28 | + |
| 29 | + rgb_frame = frame[:, :, ::-1] |
| 30 | + |
| 31 | + face_locations = face_recognition.face_locations(rgb_frame) |
| 32 | + face_encodings = face_recognition.face_encodings(rgb_frame, face_locations) |
| 33 | + name = "Unknown" |
| 34 | + |
| 35 | + for (top, right, bottom, left), face_encoding in zip(face_locations, face_encodings): |
| 36 | + # See if the face is a match for the known face(s) |
| 37 | + matches = face_recognition.compare_faces(known_face_encodings, face_encoding) |
| 38 | + |
| 39 | + face_distances = face_recognition.face_distance(known_face_encodings, face_encoding) |
| 40 | + best_match_index = qt.argmin(face_distances) |
| 41 | + if matches[best_match_index]: |
| 42 | + name = known_face_names[best_match_index] |
| 43 | + |
| 44 | + cv2.rectangle(frame, (left, top), (right, bottom), (0, 0, 255), 2) |
| 45 | + |
| 46 | + cv2.rectangle(frame, (left, bottom - 35), (right, bottom), (0, 0, 255), cv2.FILLED) |
| 47 | + font = cv2.FONT_HERSHEY_DUPLEX |
| 48 | + cv2.putText(frame, name, (left + 6, bottom - 6), font, 1.0, (255, 255, 255), 1) |
| 49 | + if name != "YOUR NAME": |
| 50 | + driver = webdriver.Chrome(executable_path="CHROME DRIVER PATH") |
| 51 | + driver.get("https://www.google.com/android/find") |
| 52 | + time.sleep(2) |
| 53 | + pyautogui.typewrite(gmail) |
| 54 | + pyautogui.press("enter") |
| 55 | + time.sleep(2) |
| 56 | + pyautogui.typewrite(password) |
| 57 | + pyautogui.press("enter") |
| 58 | + time.sleep(5) |
| 59 | + pyautogui.click(x=85,y=231) |
| 60 | + time.sleep(2) |
| 61 | + pyautogui.click(x=200,y=495) |
| 62 | + pyautogui.hotkey('ctrlleft', 'altleft', 'l') |
| 63 | + |
| 64 | + else: |
| 65 | + print("Welcome BOSS") |
| 66 | + os.system("gnome-terminal") |
| 67 | + |
| 68 | + # Display the resulting image |
| 69 | + cv2.imshow('Video', frame) |
| 70 | + |
| 71 | + |
| 72 | +# Release handle to the webcam |
| 73 | +video_capture.release() |
| 74 | +cv2.destroyAllWindows() |
0 commit comments