Supoh Ответов: 0

Как определить определенные черты лица в opencv?


I'm currently working on a machine learning project that deals with Facial Age detection in which I am required to determine whether a person is old or young through facial detection using OpenCV and keras. Currently, I've been able to detect the face and eyes of the person in the photo on OpenCV. However, I havent found a way to detect other facial features such as the forehead portion, upper portion of cheeks, eyelid regions and eye corner regions. I need to preprocess my image to detect those features in order for me to be able to use the Canny edge detection to determine the number of wrinkles on the persons face. Can anyone tell me how to detect these features on OpenCV which are forehead portion, upper portion of cheeks, eyelid regions and eye corner regions?


Что я уже пробовал:

Это мой код для обнаружения глаз и лица и Каннис:
import cv2

# Load the cascade
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')

eye_cascade = cv2.CascadeClassifier('haarcascade_eye.xml')

# Read the input image
img = cv2.imread('IMG_2017.JPG')

# Convert into grayscale
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

# Detect faces
faces = face_cascade.detectMultiScale(gray, 1.1, 4)
edges=cv2.Canny(img,100,100)
Detect eyes
eyes = eye_cascade.detectMultiScale(gray, 1.1, 12)

 #Draw rectangle around the faces
for (x, y, w, h) in faces:
    cv2.rectangle(img, (x, y), (x + w, y + h), (255, 0, 0), 2)


for (x, y, w, h) in eyes:
   cv2.rectangle(img, (x, y), (x + w, y + h), (0, 255, 0), 2)

#Display the output
cv2.imshow('img', img)
cv2.imshow('sobely',edges)
cv2.waitKey()

Gerry Schmitz

Если вы можете найти "глаза", вы должны быть в состоянии экстраполировать, где должны быть углы и веки, и начать "обнаруживать" там. Тогда продолжай идти. Если только это не паук.

0 Ответов