HaarCascade.detectMultiStage() always returning an empty tuple

252 Views Asked by At

I'm trying to do mask detection on images and I'm trying to create bounding boxes around the faces. To do that I'm using the default haarcascade xml file, but no matter what I change the classifier never detects a face.

Something I read earlier said it might have something to do with the size? Honestly am just very lost, any help is appreciated.

haarcascade = cv2.CascadeClassifier('../content/haarcascade_frontalface_default.xml')

im = cv2.imread('../content/285-with-mask.jpg')

im = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY)
im=cv2.flip(im,1,1) 
    
rerect_size = cv2.resize(im, (im.shape[1] // rect_size, im.shape[0] // rect_size))
faces = haarcascade.detectMultiScale(rerect_size)
print(faces)

The image I'm running the classifier on: [1]: https://i.stack.imgur.com/JN8QW.png

0

There are 0 best solutions below