pythonopencvface-detectiondlib

How to detect cheeks using openCV?


I am working on a virtual make-up using Python, openCV, dlib. Currently, I can get the facial landmarks like lips, nose, jaw etc. But I am quite unsure on getting the points of the cheeks.

Are they any recommendations?


Solution

  • If you're using dlib 68 facial landmarks, here are the ROIs of the 2 cheeks:

    from imutils import face_utils
    
    #face detection part
    
    #rect is the face detected
    shape = predictor(gray_img, rect)
    shape = face_utils.shape_to_np(shape)
    
    img[shape[29][1]:shape[33][1], shape[54][0]:shape[12][0]] #right cheeks
    img[shape[29][1]:shape[33][1], shape[4][0]:shape[48][0]] #left cheek
    

    enter image description here