isNoseInBox static method
Implementation
static bool isNoseInBox(
double imageHeight,
double centerXStart,
double centerXEnd,
Map<FaceContourType, FaceContour?> contours,
) {
bool isNoseInCenter = false;
final nosePoints = contours[FaceContourType.noseBridge]?.points;
if (nosePoints != null && nosePoints.isNotEmpty) {
final noseCenterPoint = nosePoints[nosePoints.length ~/ 2];
final nosePos = Offset(
noseCenterPoint.x.toDouble(), noseCenterPoint.y.toDouble() - 300);
final double noseTop = imageHeight * 0.35;
final double noseBottom = imageHeight * 0.65;
final noseHorizontallyCentered =
nosePos.dx >= centerXStart && nosePos.dx <= centerXEnd;
final noseVerticallyCentered =
nosePos.dy >= noseTop && nosePos.dy <= noseBottom;
isNoseInCenter = noseHorizontallyCentered && noseVerticallyCentered;
}
return isNoseInCenter;
}