I am currently trying to get the ROI of both eyes in a face. However, it is only returning the right eye. How do I get the ROI of both eyes like in a single frame?
for (x,y,w,h) in faces:
cv2.rectangle(img, (x, y), (x + w, y + h),(0,255,0), 2)
faceROI = img[y:y+h,x:x+w]
smile_rects = smile_cascade.detectMultiScale(faceROI, scaleFactor=1.1, minNeighbors=10, minSize=(15, 15), flags=cv2.CASCADE_SCALE_IMAGE)
eyes = eye_cascade.detectMultiScale(faceROI)
for (x2, y2, w2, h2) in eyes:
ptA = (x + x2, y + y2)
ptB = (x + x2 + w2, y + y2 + h2)
cv2.rectangle(img, ptA, ptB, (0, 0, 255), 2)
eyeROI = faceROI[y2:y2+h2,x2:x2+w2]
cv2.imshow('image', img)
cv2.imshow('EyeROI', eyeROI)
cv2.waitKey(0)