

VS community





from face_engine import FaceEngine
from PIL import Image, ImageDraw
import matplotlib.pylab as plt
engine = FaceEngine()
imgFileName = ''
imgFileName = ''
try:
boxes, extra = engine.find_faces(imgFileName)
print( boxes )
img = Image.open( imgFileName )
drawing = ImageDraw.Draw( img )
for i in range( len( boxes ) ):
shape = [(boxes[i][0], boxes[i][1]),
(boxes[i][2], boxes[i][3])]
drawing.rectangle( shape,
outline= 'red',
width= 2)
plt.imshow(img)
plt.show()
except:
print('No face found')




from face_engine import FaceEngine
from PIL import Image, ImageDraw
import matplotlib.pylab as plt
engine = FaceEngine()
imgList = []
imgLabel = []
engine.fit( imgList, imgLabel)
testImage = ''
boxes, rames = engine.make_prediction( testImage )
print( rames, boxes )
img = Image.open(testImage)
crawing = ImageDraw.Draw( img )
for i in range( len( boxes ) ):
shape = [(boxes[i][0], boxes[i][1]),
(boxes[i][2], boxes[i][3])]
drawing.rectangle( shape,
outline= 'red',
width= 2)
plt.imshow(img)
plt.show()




import face_recognition
from PIL import Image, ImageDraw
import matplotlib.pylab as plt
imgX = ''
image = face_recognition.load_image_file(imgX)
landmarks = face_recognition.face_landmarks(image)
print(landmarks)
print(f'nose: {landmarks[0]["nose_bridge"]}')
img = Image.open(imgX)
drawing = ImageDraw.Draw(img)
for landmark in landmarks:
for feature in landmark.keys():
drawing.line( landmark[feature], width= 5)
plt.imshow(img)
plt.show()
