Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No face detected in image #37

Open
cronero95 opened this issue Apr 9, 2020 · 1 comment
Open

No face detected in image #37

cronero95 opened this issue Apr 9, 2020 · 1 comment

Comments

@cronero95
Copy link

Hello, I am doing a simple test; I take a picture with 5 faces, each in a different position, then try to detect the faces, but the "faces" list is empty.

Here is the image I used: https://drive.google.com/open?id=1v8C-SP0nsZ4aLuyLu8f3tjA7uI6JaQ2R

This is the code:

import cvlib as cv
import cv2

imgColor = cv2.imread('D:/images/rostro_poses.jpg', -1)

faces, confidences = cv.detect_face(imgColor)

for face,conf in zip(faces,confidences):

    (startX,startY) = face[0],face[1]
    (endX,endY) = face[2],face[3]

    cv2.rectangle(imgColor, (startX,startY), (endX,endY), (255,0,0), 2)
    
cv2.imshow('something', imgColor)

Thanks for the help.

@atinshakya
Copy link

**using this code

import cv2

Load Trained cascade classifier

face_cascade = cv2.CascadeClassifier('C:/Users/Atin/Desktop/haarcascade_frontalface_default.xml')

#Read the given image

img = cv2.imread('C:/Users/Atin/Downloads/group.jpg')

Convert color image into grayscale

gray_image = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

Dectect face ROI

#syntax: classifer.detectMultiScale(input image,scale factor,mini navores)

facce = face_cascade.detectMultiScale(img,5.5,4)
print(facce)

#draw Rectangle around the face

for (x,y,w,h) in facce:
cv2.rectangle(img,(x,y),(x+w,y+h),(0,255,0),4)

#show image

cv2.imshow('output img',img)

#wait for close window

cv2.waitKey()

#close all windows

cv2.destroyAllWindows()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants