I want to detect face and show contours.I have detected the face but how to show contours.Any suggestions is accepted.I have searched on google but I did t find find solution; Thanks in advance.
class FacePainter extends CustomPainter {
ui.Image image;
List<Face> faces;
List<Rect> rects = [];
FacePainter(this.image, this.faces) {
for (var i = 0; i < faces.length; i++) {
rects.add(faces[i].boundingBox);
}
print("object");
}
@override
void paint(ui.Canvas canvas, ui.Size size) {
final Paint paint = Paint()
..style = PaintingStyle.stroke
..strokeWidth = 2.0
..color = Colors.blue;
canvas.drawImage(image, Offset.zero, paint);
for (var i = 0; i < faces.length; i++) {
canvas.drawRect(rects[i], paint);
}
}
@override
bool shouldRepaint(FacePainter oldDelegate) {
return image != oldDelegate.image || image != oldDelegate.faces;
}
}