extractFeatures static method
Extract a normalized feature vector from a Face.
Returns null if the face has no contour data (ensure ML Kit is configured
with enableContours: true).
Implementation
static List<double>? extractFeatures(Face face) {
final box = face.boundingBox;
if (box.width == 0 || box.height == 0) return null;
final features = <double>[];
for (final type in _contourTypes) {
final contour = face.contours[type];
if (contour == null) return null;
for (final point in contour.points) {
// Normalize to 0.0–1.0 relative to bounding box.
features.add((point.x - box.left) / box.width);
features.add((point.y - box.top) / box.height);
}
}
if (features.isEmpty) return null;
return features;
}