pycharm install face_recognition
$ git clone git://github.com/ageitgey/face_recognition
pycharm install face_recognition
$ git clone git://github.com/ageitgey/face_recognition
python face recognition
import cv2
video_capture = cv2.VideoCapture(0)
# Loading the required haar-cascade xml classifier file, classifies face from non face
haar_cascade = cv2.CascadeClassifier('Haarcascade_frontalface_default.xml')
print(haar_cascade)
while True:
# Capture frame-by-frame
ret, img = video_capture.read()
# Converting image to grayscale, detection model sees it as grayscale
gray_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
# Applying the face detection method on the grayscale image
faces_rect = haar_cascade.detectMultiScale(gray_img, 1.1, 9)
# Iterating through rectangles of detected faces, displaying the rectangle
for (x, y, w, h) in faces_rect:
cv2.rectangle(img, (x, y), (x+w, y+h), (70, 0, 255), 2)
# Display the resulting frame
cv2.imshow('Video', img)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# When everything is done, release the capture
video_capture.release()
cv2.destroyAllWindows()
module named 'face_recognition
import face_recognition
image = face_recognition.load_image_file("My_Image.png")
face_locations = face_recognition.face_locations(image)
print("I found {} face(s) in this photograph.".format(len(face_locations)
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us