Answers for "import face_recognition"

1

pycharm install face_recognition

$ git clone git://github.com/ageitgey/face_recognition
Posted by: Guest on May-05-2020
0

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()
Posted by: Guest on April-22-2022
0

python face recognition

# simple python code: face recognition
import cv2
import numpy as np

detect = cv2.CascadeClassifier(cv2.data.haarcascades +'haarcascade_frontalface_default.xml')

cam = cv2.VideoCapture('image.jpg')
check, img = cam.read()

gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
faces = detect.detectMultiScale(gray,1.2,5)

for (x,y,w,h) in faces:
      cv2.rectangle(img, (x,y), (x+w, y+h), (255, 0, 0), 2)

cv2.imshow('Face Detect', img)
cv2.waitKey(600000)

cam.release()
cv2.destroyAllWindows()
Posted by: Guest on May-12-2022
-1

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)
Posted by: Guest on July-06-2021

Code answers related to "import face_recognition"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language