Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Face_recongize

Alexchenys Apr 8th, 2020 160 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # -*- coding: utf-8 -*-
  2. """
  3. Created on Sun Apr  5 01:55:37 2020
  4.  
  5. @author: USER
  6. """
  7. import serial
  8. import time
  9. import face_recognition
  10. import cv2
  11.  
  12. # Get a reference to webcam #0 (the default one)
  13. video_capture = cv2.VideoCapture(0)
  14.  
  15. # Initialize some variables
  16. face_locations = []
  17. counter = 0
  18. send=serial.Serial('COM4',115200)
  19. time.sleep(5)
  20. send.write(b'mac join abp')
  21.  
  22. while True:
  23.     # Grab a single frame of video
  24.     ret, frame = video_capture.read()
  25.    
  26.     # Resize frame of video to 1/4 size for faster face detection processing
  27.     small_frame = cv2.resize(frame, (0, 0), fx=0.25, fy=0.25)
  28.    
  29.     # Find all the faces and face encodings in the current frame of video
  30.     face_locations = face_recognition.face_locations(small_frame, model="cnn")
  31.    
  32.     if(len(face_locations) >= 1):
  33.         print("I found {} face(s) in this photograph.".format(len(face_locations)))
  34.  
  35.         #while True:
  36.         time.sleep(5)
  37.         send.write(b'mac tx ucnf 2 024945121225')
  38.     else:
  39.         print("Nothing here")
  40.     # Display the results
  41.    
  42.     cv2.imshow('Video', small_frame)
  43.  
  44.     # Hit 'q' on the keyboard to quit!
  45.     if cv2.waitKey(1) & 0xFF == ord('q'):
  46.         break
  47.  
  48. # Release handle to the webcam
  49. video_capture.release()
  50. cv2.destroyAllWindows()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top