Open ishitasinghal opened 3 years ago
`import cv2 trained_face_data = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
img = cv2.imread('am.jpg')
bwimg = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
face_crdnts = trained_face_data.detectMultiScale(bwimg) (x, y, w, b) = face_crdnts #problem in this line
cv2.rectangle(img, (x,y), (x+w, y+b), (0, 300, 0), 1) cv2.imshow("That's u!!",img) cv2.waitKey() print("I am done!")`
This is a face detection code snippet I am trying to run, but it is giving the "ValueError". I tried to use the for loop to get the variables from the list being created in the coordinate detect function, but it still doesn't work.
Can anyone help me with this code.
face_crdnts only have 1 value. you should check type and shape of face_crdnts...
`import cv2 trained_face_data = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
img = cv2.imread('am.jpg')
bwimg = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
face_crdnts = trained_face_data.detectMultiScale(bwimg) (x, y, w, b) = face_crdnts #problem in this line
cv2.rectangle(img, (x,y), (x+w, y+b), (0, 300, 0), 1) cv2.imshow("That's u!!",img) cv2.waitKey() print("I am done!")`
This is a face detection code snippet I am trying to run, but it is giving the "ValueError". I tried to use the for loop to get the variables from the list being created in the coordinate detect function, but it still doesn't work.
Can anyone help me with this code.