Professional Documents
Culture Documents
Face recognition
Name: KESAV.V
Reg.no: 22617501
Department: B. Tech - IT
Face recogni on
Algorithm:
Step - 1: Install visual studio code with python compiler.
Step - 2: And then import necessary Libraries like Import face_recogni on and cv2 (OpenCV)
libraries.
Step - 4: Then save photo in .jpg format in desire loca on and compare using photo vs webcam.
Step - 5: To verify the face. Print name in any where of the screen. If not verified print unknown
person.
Step - 6: A er comple ng the verifica on. Try to draw a square outside of the face from live
webcam.
Step - 7: A er crea ng square print name of the person in top le corner of the square.
Step - 6: Finally check whether the face recogni on is working (or) not by checking the face from the
data base.
Python programming
Main.py
import cv2
sfr = SimpleFacerec()
sfr.load_encoding_images("images/")
# Load Camera
cap = cv2.VideoCapture(0)
while True:
ret, frame = cap.read()
# Detect Faces
cv2.imshow("Frame", frame)
key = cv2.waitKey(1)
if key == 27:
break
cap.release()
cv2.destroyAllWindows()
image_comparison.py
import cv2
sfr = SimpleFacerec()
sfr.load_encoding_images("images/")
# Load Camera
cap = cv2.VideoCapture(0)
while True:
# Detect Faces
cv2.imshow("Frame", frame)
key = cv2.waitKey(1)
if key == 27:
break
cap.release()
cv2.destroyAllWindows()