I wrote this simple program of facial recognition in image but haar cascade file is not loading in cascade classifier
import cv2
img = cv2.imread(“photo/3.jpg”)
grey_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
haar_cascade = cv2.CascadeClassifier(“Haarcascade_frontalface_default.xml”)
faces_rect = haar_cascade.detectMultiScale(grey_img, 1.1, 9)
for (x, y, w, h) in faces_rect:
cv2.rectangle(img, (x, y), (x + w, y + h), (0, 255, 0), 2)
cv2.imshow(“Recognized Faces”, img)
cv2.waitKey(0)
cv2.destroyAllWindows()
Ahmad Danyal 56 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.