Jan-10-2022, 11:06 PM
(This post was last modified: Jan-10-2022, 11:06 PM by buzzdarkyear.)
When I only detect the face the camera zoom on the face and follows it. But when I want to detect & zoom/follow the mouth it doesn't.
Mouth detection only work when the face is detected first so I can't just detect only the mouth as I could detect the face.
So this works:
But this doesn't:
What is the problem? How do I make this work?? How will I be able to detect the mouth and zoom/follow it? Any help or tips are welcome!
Main.py(full code):
https://raw.githubusercontent.com/kailau...in/main.py
Frame.py:
https://raw.githubusercontent.com/kailau...n/Frame.py
Mouth detection only work when the face is detected first so I can't just detect only the mouth as I could detect the face.
So this works:
1 2 3 |
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) face = face_cascade.detectMultiScale(gray, scaleFactor = SCALE_FACTOR, minNeighbors = MIN_NEIGHBORS, minSize = MINSIZE, ) boxes = np.array(face) |
1 2 3 4 5 6 |
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) face = face_cascade.detectMultiScale(gray, 1.3 , 15 ) for (x, y, w, h) in face: roi_gray = gray[y:y + w, x:x + w] mouth = mouth_cascade.detectMultiScale(roi_gray, scaleFactor = SCALE_FACTOR, minNeighbors = MIN_NEIGHBORS, minSize = MINSIZE,) boxes = np.array(mouth) |
Main.py(full code):
https://raw.githubusercontent.com/kailau...in/main.py
Frame.py:
https://raw.githubusercontent.com/kailau...n/Frame.py