├── .gitignore ├── run.py ├── Image ├── 0.jpg ├── 1.jpg ├── 10.jpg ├── 11.jpg ├── 12.jpg ├── 13.jpg ├── 14.jpg ├── 15.jpg ├── 16.jpg ├── 17.jpg ├── 18.jpg ├── 19.jpg ├── 2.jpg ├── 20.jpg ├── 21.jpg ├── 3.jpg ├── 4.jpg ├── 5.jpg ├── 6.jpg ├── 7.jpg ├── 8.jpg └── 9.jpg ├── Readme.md └── __main__.py /.gitignore: -------------------------------------------------------------------------------- 1 | /__pycache__ -------------------------------------------------------------------------------- /run.py: -------------------------------------------------------------------------------- 1 | def run (): 2 | print("Success") -------------------------------------------------------------------------------- /Image/0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Adityaadpandey/simple-Face-Recog/HEAD/Image/0.jpg -------------------------------------------------------------------------------- /Image/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Adityaadpandey/simple-Face-Recog/HEAD/Image/1.jpg -------------------------------------------------------------------------------- /Image/10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Adityaadpandey/simple-Face-Recog/HEAD/Image/10.jpg -------------------------------------------------------------------------------- /Image/11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Adityaadpandey/simple-Face-Recog/HEAD/Image/11.jpg -------------------------------------------------------------------------------- /Image/12.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Adityaadpandey/simple-Face-Recog/HEAD/Image/12.jpg -------------------------------------------------------------------------------- /Image/13.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Adityaadpandey/simple-Face-Recog/HEAD/Image/13.jpg -------------------------------------------------------------------------------- /Image/14.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Adityaadpandey/simple-Face-Recog/HEAD/Image/14.jpg -------------------------------------------------------------------------------- /Image/15.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Adityaadpandey/simple-Face-Recog/HEAD/Image/15.jpg -------------------------------------------------------------------------------- /Image/16.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Adityaadpandey/simple-Face-Recog/HEAD/Image/16.jpg -------------------------------------------------------------------------------- /Image/17.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Adityaadpandey/simple-Face-Recog/HEAD/Image/17.jpg -------------------------------------------------------------------------------- /Image/18.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Adityaadpandey/simple-Face-Recog/HEAD/Image/18.jpg -------------------------------------------------------------------------------- /Image/19.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Adityaadpandey/simple-Face-Recog/HEAD/Image/19.jpg -------------------------------------------------------------------------------- /Image/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Adityaadpandey/simple-Face-Recog/HEAD/Image/2.jpg -------------------------------------------------------------------------------- /Image/20.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Adityaadpandey/simple-Face-Recog/HEAD/Image/20.jpg -------------------------------------------------------------------------------- /Image/21.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Adityaadpandey/simple-Face-Recog/HEAD/Image/21.jpg -------------------------------------------------------------------------------- /Image/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Adityaadpandey/simple-Face-Recog/HEAD/Image/3.jpg -------------------------------------------------------------------------------- /Image/4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Adityaadpandey/simple-Face-Recog/HEAD/Image/4.jpg -------------------------------------------------------------------------------- /Image/5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Adityaadpandey/simple-Face-Recog/HEAD/Image/5.jpg -------------------------------------------------------------------------------- /Image/6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Adityaadpandey/simple-Face-Recog/HEAD/Image/6.jpg -------------------------------------------------------------------------------- /Image/7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Adityaadpandey/simple-Face-Recog/HEAD/Image/7.jpg -------------------------------------------------------------------------------- /Image/8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Adityaadpandey/simple-Face-Recog/HEAD/Image/8.jpg -------------------------------------------------------------------------------- /Image/9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Adityaadpandey/simple-Face-Recog/HEAD/Image/9.jpg -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | # To Install Dlib for Python 2 | 3 | 4 | `git clone https://github.com/Universe-ML21/script_install_dlib.git` 5 | 6 | `sudo chmod +x script_install_dlib/auto_dlib.sh` 7 | 8 | `bash script_install_dlib/auto_dlib.sh` -------------------------------------------------------------------------------- /__main__.py: -------------------------------------------------------------------------------- 1 | import face_recognition 2 | import cv2 3 | import os 4 | import run 5 | # import numpy as np 6 | 7 | cap = cv2.VideoCapture(-1) 8 | 9 | l1 = [] 10 | di1= r'Image/' 11 | 12 | 13 | count1 = 0 14 | dir_path = di1 15 | for path in os.scandir(dir_path): 16 | if path.is_file(): 17 | count1 += 1 18 | # print('file count:', count) 19 | for i in range(0,count1): 20 | a = str(i)+'.jpg' 21 | img = face_recognition.load_image_file(di1+a) 22 | img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) 23 | encodingElon = face_recognition.face_encodings(img)[0] 24 | l1.append(encodingElon) 25 | 26 | 27 | 28 | # if 'name' is 29 | while True: 30 | success, img = cap.read() 31 | img = cv2.flip(img,1) 32 | try: 33 | rfaceLoc = face_recognition.face_locations(img)[0] 34 | cv2.rectangle(img, (rfaceLoc[3], rfaceLoc[0]), 35 | (rfaceLoc[1], rfaceLoc[2]), (255, 0, 0), 2) 36 | encodingElon = face_recognition.face_encodings(img)[0] 37 | results = face_recognition.compare_faces(l1, encodingElon) 38 | # print(results) 39 | l = len(results) 40 | # results = str(results) 41 | # rs1 = results.replace('True', 1) 42 | # rs2 = rs1.replace('False', 0) 43 | # rs3 = rs2.replace('[', '') 44 | # rs4 = rs3.replace(']', '') 45 | # rs5 = rs4.replace(' ', '') 46 | sum = 0 47 | for i in range(0,l): 48 | if results[i] == True: 49 | sum = sum + 1 50 | total = sum/l 51 | print(total) 52 | if total > 0.9: 53 | cv2.putText(img, 'Mr. Aditya', (rfaceLoc[3], rfaceLoc[0]), 54 | cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 255), 2) 55 | run.run() 56 | break 57 | except: 58 | pass 59 | cv2.imshow("Face", img) 60 | cv2.waitKey(1) 61 | --------------------------------------------------------------------------------