I have achieved something similar to this in a project i worked on in the past but no longer have access to the project.
when you call your capture method you need to store a reference to the position of the face.
Im not sure how much control the vision api gives you over the camera so you either:
take the picture and before saving the file add the mask resource on top of the returned bitmap.
or
load the saved file add the mask resource on top of the it.
I will have a look around later for some code if it will help.
Edit Rotate Bitmap
bitmap = android.provider.MediaStore.Images.Media
.getBitmap(cr, selectedImage);
ExifInterface exif = new ExifInterface("/storage/emulated/0/Pic.jpg");
String exifOrientation = exif.getAttribute(ExifInterface.TAG_ORIENTATION);
int i = Integer.parseInt(exifOrientation);
bitmap = rotateImage(bitmap, i);
//
private Bitmap rotateImage(Bitmap bm, int i) {
Matrix matrix = new Matrix();
switch (i) {
case ExifInterface.ORIENTATION_NORMAL:
return bm;
case ExifInterface.ORIENTATION_FLIP_HORIZONTAL:
matrix.setScale(-1, 1);
break;
case ExifInterface.ORIENTATION_ROTATE_180:
matrix.setRotate(180);
break;
case ExifInterface.ORIENTATION_FLIP_VERTICAL:
matrix.setRotate(180);
matrix.postScale(-1, 1);
break;
case ExifInterface.ORIENTATION_TRANSPOSE:
matrix.setRotate(90);
matrix.postScale(-1, 1);
break;
case ExifInterface.ORIENTATION_ROTATE_90:
matrix.setRotate(90);
break;
case ExifInterface.ORIENTATION_TRANSVERSE:
matrix.setRotate(-90);
matrix.postScale(-1, 1);
break;
case ExifInterface.ORIENTATION_ROTATE_270:
matrix.setRotate(-90);
break;
default:
return bm;
}
try {
Bitmap bmRotated = Bitmap.createBitmap(bm, 0, 0, bm.getWidth(), bm.getHeight(), matrix, true);
bm.recycle();
return bmRotated;
} catch (OutOfMemoryError e) {
e.printStackTrace();
return null;
}
}