isMouthHorizontallyCentered static method
bool
isMouthHorizontallyCentered(
- double centerXStart,
- double centerXEnd,
- Map<FaceContourType, FaceContour?> contours
)
Implementation
static bool isMouthHorizontallyCentered(
double centerXStart,
double centerXEnd,
Map<FaceContourType, FaceContour?> contours,
) {
// Mouth center alignment
final upperLip = contours[FaceContourType.upperLipTop]?.points;
bool isMouthHorizontallyCentered = true;
if (upperLip != null && upperLip.isNotEmpty) {
final mouthCenterX =
upperLip.map((p) => p.x).reduce((a, b) => a + b) / upperLip.length;
isMouthHorizontallyCentered =
mouthCenterX >= centerXStart && mouthCenterX <= centerXEnd;
}
return isMouthHorizontallyCentered;
}