I' using haar cascade for face detection
faces_haar = face_cascade.detectMultiScale(image, scaleFactor=1.3, minNeighbors=4, minSize=(30, 30), flags=cv2.CASCADE_SCALE_IMAGE)
and i save the face in this variables
(x, y, w, h) = faces_haar[0]
and in my fucntion i return
return image[y:y+h, x:x+w] , faces_haar[0]
when he dont find any face gives me the error "IndexError: tuple index out of range" because i dont have any face.
How i can return only when he find some face?