File size: 615 Bytes
08b7b53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from face_recognition import hog as faces_detect
import cv2
from image_processing_operations import resize_image


def face_rec_reshape(img):
    Liste_de_visages = []
    faces = faces_detect(img)
    for (x, y, w, h) in faces: 
        crop_img = img[y:y+h, x:x+w]
        image_finale = resize_image(crop_img,224,224)
        Liste_de_visages.append(image_finale)
    return Liste_de_visages

if __name__ == "__main__" :
    url = "./Data/Abbi.jpg"
    Img = cv2.imread(url, 1)
    img = face_rec_reshape(Img)
    for imgf in img :
        cv2.imshow('img', imgf)
        cv2.waitKey()
    cv2.destroyWindow()