I have been writing a code about autoencoencoder for face recognition the part of code I used is as follows:
face_cascade = cv2.CascadeClassifier('C:/Users/PC/PycharmProjects/haarcascade_frontalface_default.xml')
print(face_cascade)
img = cv2.imread('C:/Users/PC/PycharmProjects/exmpforbike6/training_images/JenniferGroup.jpg')
print(img)
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
print("voici",gray)
faces = face_cascade.detectMultiScale(gray, 1.3, 5)
for (x, y, w, h) in faces:
cv2.rectangle(img, (x, y), (x + w, y + h), (0, 255, 0), 2)
roi_gray = gray[y:y + h, x:x + w]
roi_color = img[y:y + h, x:x + w]
a = []
for i in range(0, faces.shape[0]):
a.append(gray[faces[i][1]:faces[i][1] + faces[i][3], faces[i][0]:faces[i][0] + faces[i][2]])
this is the error i get :
AttributeError: 'tuple' object has no attribute 'shape'
the error is in this line:
for i in range(0, faces.shape[0]):
a.append(gray[faces[i][1]:faces[i][1] + faces[i][3], faces[i][0]:faces[i][0] + faces[i][2]])
Any idea on how I can fix it??