conda create -n test(가상환경 이름)
conda activate test(가상환경 이름)
conda install numpy
conda install pillow
conda install opencv
conda install scipy
conda install cmake
conda install -c conda-forge dlib
conda install -c akode face_recogntion_models
import face_recognition
import os
import matplotlib.image as img
import matplotlib.pyplot as pp입력하세요
images = os.listdir('images')
print(images)
image_to_be_matched = face_recognition.load_image_file('0.jpg')
image_to_be_matched_encoded = face_recognition.face_encodings(image_to_be_matched)[0]
for image in images:
current_image = face_recognition.load_image_file("images/" + image)
current_image_encoded = face_recognition.face_encodings(current_image)[0]
result = face_recognition.compare_faces([image_to_be_matched_encoded], current_image_encoded)
if result[0] == True:
print("Matched: " + image)
fileName = "images/" + image
ndarray = img.imread(fileName)
pp.imshow(ndarray)
pp.show()
break
#else:
#print("Not matched: " + image)