I need to crop detected faces and save them as image files. I am able to detect face with rounded rectangles, but how do I crop the area of the detected face? I am using google_mlkit_face_detectiont to detect faces. Here is my code:
Future _processImage(InputImage inputImage) async {
final faces = await _faceDetector.processImage(inputImage);
if (faces.isNotEmpty) {
final boundingBox = faces.first.boundingBox;
final left = boundingBox.left.toInt();
final top = boundingBox.top.toInt();
final width = boundingBox.width.toInt();
final height = boundingBox.height.toInt();
}
}