MediaPipe FaceMesh
Detect the lower face with MediaPipe's FaceMesh detector.
This detector is based on the face landmarker task from MediaPipe. The face landmarker provides locations of more than 450 facial landmarks. From these, we can define a region for the lower face, as is done for example by Li et al. (2014)1.
-
X. Li, J. Chen, G. Zhao, and M. Pietikainen, “Remote Heart Rate Measurement From Face Videos Under Realistic Situations”, Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 4264-4271, 2014 doi:10.1109/CVPR.2014.543 ↩
FaceMeshDetector
Bases: RoiDetector
Face detector using MediaPipe's face landmarker.
Source code in src\yarppg\roi\facemesh_segmenter.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
|
detect(frame)
Find face landmarks and create ROI around the lower face region.
Source code in src\yarppg\roi\facemesh_segmenter.py
draw_facemesh(img, face_landmarks, tesselate=False, contour=False, irises=False)
Draw the detected face landmarks on the image.
Source code in src\yarppg\roi\facemesh_segmenter.py
get_boundingbox_from_coords(coords)
Calculate the bounding rectangle containing all landmarks.
get_face_landmarker_modelfile()
Get the filename of the FaceLandmarker - download file if necessary.
Source code in src\yarppg\roi\facemesh_segmenter.py
get_landmark_coords(landmarks, width, height)
Extract normalized landmark coordinates to array of pixel coordinates.