eyeRoisFromMesh function
Computes the eye ROIs from the canonical mesh landmark indices used by MediaPipe (left: 33/133, right: 362/263).
Implementation
List<AlignedRoi> eyeRoisFromMesh(List<Point> meshAbs) {
AlignedRoi fromCorners(int a, int b) {
final Point p0 = meshAbs[a];
final Point p1 = meshAbs[b];
final double cx = (p0.x + p1.x) * 0.5;
final double cy = (p0.y + p1.y) * 0.5;
final double dx = p1.x - p0.x;
final double dy = p1.y - p0.y;
final double eyeDist = math.sqrt(dx * dx + dy * dy);
return AlignedRoi(cx, cy, eyeDist * 2.3, math.atan2(dy, dx));
}
return [fromCorners(33, 133), fromCorners(362, 263)];
}