When I crop only face it does the job, but when I want to crop eyes, nose, mouth that are detected in the face it doesn’t.
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) face_detection = face_cascade.detectMultiScale(gray, 1.3, 5) for (x, y, w, h) in face_detection: gray2 = gray[y:y+h, x:x+w] left_eye_detection = left_eye_cascade.detectMultiScale(gray2, 1.3, 22) for (ex, ey, ew, eh) in left_eye_detection: crop_img = frame[ey:ey+eh, ex:ex+ew] cv2.imshow("cropped", crop_img)
What am I doing wrong? I’m new to Python and OpenCV. My apologies if I made a stupid mistake. I’m just very eager to learn.