Modification of the photo + ROI
This commit is contained in:
parent
741b3138f7
commit
fb7884e217
Binary file not shown.
|
After Width: | Height: | Size: 141 KiB |
|
|
@ -8,7 +8,7 @@ face_cascade = cv2.CascadeClassifier("Haar_Cascade.xml")
|
|||
|
||||
# Charger l'image dans OpenCV
|
||||
# Convertir l'image en niveaux de gris
|
||||
img = cv2.imread("Image.jpg")
|
||||
img = cv2.imread("PhotoTest.jpg")
|
||||
gray_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
|
||||
# Just to check if there is a photo
|
||||
if gray_img.shape[0] == 0 or gray_img.shape[1] == 0:
|
||||
|
|
@ -19,8 +19,8 @@ face = face_cascade.detectMultiScale(gray_img, scaleFactor=1.1, minNeighbors=5)
|
|||
print(face)
|
||||
# Dessiner un rectangle autour de chaque visage détecté
|
||||
for x, y, w, h in face:
|
||||
img = cv2.rectangle(img, (int(x*1.15), int(y*1.1)),
|
||||
(x + int(w*0.8), y + int(h*0.5)), (0, 255, 0), 3)
|
||||
img = cv2.rectangle(img, (int(x*1.2), int(y*1.15)),
|
||||
(x + int(w*0.7), y + int(h*0.2)), (0, 255, 0), 3)
|
||||
|
||||
# Afficher l'image
|
||||
cv2.imshow("Faces", img)
|
||||
|
|
|
|||
Loading…
Reference in New Issue