كان فيه مشكله فيه االصوره مش واضح خالص
بس الحمد الله تمام دلوقتي وده الكود
import face_recognition
from PIL import Image , ImageDraw
import numpy
# File Image
malan = face_recognition.load_image_file("Malan.png")
harvard = face_recognition.load_image_file("Harvard.jpg")
# encodings
harvard_locations = face_recognition.face_locations(harvard)
harvard_encodings = face_recognition.face_encodings(harvard , harvard_locations)
malan_encoding = face_recognition.face_encodings(malan)[0]
# file Image Pillow
img = Image.fromarray(harvard)
draw = ImageDraw.Draw(img)
# for loop faces
for(top ,right, bottom , left) , face_encoding in zip(harvard_locations , harvard_encodings):
matches = face_recognition.compare_faces([malan_encoding] , face_encoding)
face_distance = face_recognition.face_distance([malan_encoding] , face_encoding)
best_match_index = numpy.argmin(face_distance)
if matches[best_match_index]:
draw.rectangle(((left , top) , (right , bottom)) , outline=(0,255,0) , width=5)
else:
draw.rectangle(((left , top) , (right , bottom)) , outline=(255,0,0) , width=5)
del draw
img.show()
بس اخر سوال
السطر القبل الاخير الهو del draw
هو ليه عامل كده يعني