Why Does OpenCV Won't Detect Eyes With Haar Cascades In Python? -


I am trying to detect a pair of eyes inside a rectangular shape that appears when OpenCV 2.4.x Python. Here is my code:

  FACE_DETECT = "lbpcascade_frontalface.xml" EYE_DETECT = "haarcascade_eye.xml" DOWNSCALE = 4 webcam = cv2.VideoCapture (0) face_classifier = cv2.CascadeClassifier (FACE_DETECT) eye_classifier = Cv2 if webcam.OPPD (): #csscade classifier (EEEEEDactCT): # Try to get the first frame rival, frame = webcam. Reed () Other: Ravel = False while Rev: Minoisage = (frame size [1] / dotscale, frame size [0] / DOWNSCALE) miniframe = cv2.resize (frame, at least) faces = face _classifier. DCTExamulti Skelele (Minibrammem) Eyes = I-Classifier. FT, FE, FW, FH = [FV] in DOWNSCALE FV cv2.rectangle (frame, (fx, fy), (fx + fw, fy + fh), (0, 0, 255) for DCTF fax (Ex, ey, ew, eh) in eyes: cv2 rectangle (frame, (east, ei), ((pre + ew), (IE + eh)), (50, 50, 50), 3) cv 2. IMhho ("eyes =% s"% (eyes,), frame) cv2.imshow ("cam", frame) ravel, frame = webcam.read () key = cv2.wait key (20) if key [27, ord ('Q'), and ('q')]: exit on # esc brake  

My face detection code works in this but does not have eye-detective part ( If I can have good use then I also include face detection code). I've added some print () statements inside the loop sequence of the eyes:

 for  (ex, EE, EU, eh) in eyes: cv2.rectangle (frame, (ex, (eyes) ,), Frame)  ), ((former + EV), (IE + EH)), (50, 50, 50), 3) CV2. / Ex> 

However, no output is displayed.
If the face recognition works, the eye should be detected or at least in the eye loop should go. I have probably thought of a wrong algorithm, how can I figure out the eyes?

Any help would be appreciated. :)

What do you have to do is look for eyes on the face and not the whole image by cropping this image And only by getting the face, you can try to find the eyes in that image

  sub_face = miniframe [fy: fy + fh, fx: fx + fw] eyes = in the eyes (east , EE, EU, EH) eye_classifier.detectMultiScale (sub_frame): cv2.rectangle (frame, (Fx + EX, fy + ey), ((fx + ex + ew), (fy + ey + eh)) , (50, 50, 50), 3)  

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -