FaceAlign
FaceAlign[image]
attempts to find faces in image and align them.
FaceAlign[image,fref]
gives aligned faces according to the face reference fref.
FaceAlign[image,fref,size]
gives aligned faces of the specified size.
FaceAlign[{image1,image2,…},…]
gives a list of aligned faces for all imagei.
Details and Options
- Face alignment is the process of transforming faces to align certain facial landmarks of multiple faces and is typically used for morphing, comparing or recognizing faces.
- FaceAlign uses FindFaces to find faces in image.
- The reference face fref can be any of the following:
-
Automatic automatically align the faces face use the landmarks of face {feat1,feat2,…} use the default positions for features feati <feat1point1,… > explicit positions for features feati - When fref is Automatic, face landmarks are aligned to a predefined set of locations.
- Possible values for pointi are:
-
Automatic use the default reference {x,y} explicit coordinates Scaled[{x,y}] scaled coordinates - Possible settings for feati include:
-
"LeftEyeCenter" center of the left eye "RightEyeCenter" center of the right eye "EyeCenter" point at the center of the eyes "NoseCenter" point at the center of the nose "MouthCenter" point at the center of the mouth "MouthLeft" point of the left of the mouth "MouthRight" point of the right of the mouth - The size can be any of the following:
-
Automatic automatic choice Full use the original face size s width and height of size s {w,h} explicit width and height f function f to be applied to the list of widths, using a height that gives median aspect ratio - By default, all faces are resized to have the median width and a height to give the median aspect ratio.
- The following options can be given:
-
PaddingSize None how much padding to leave around the face Method Automatic method to use Padding "Fixed" padding scheme to use PerformanceGoal "Speed" aspects of performance to try to optimize Resampling Automatic resampling method TransformationClass "Affine" relation between image and reference - The PaddingSize can be used to add padding around the face bounding box while keeping the overall size constant. Possible settings are:
-
d add d pixels around the specified bounding box Scaled[s] add a multiple s of the bounding box size {specx,specy} use different horizontal and vertical specifications - By default, the faces are detected automatically. Use Method{"FaceBoxes"boxes} to specify bounding boxes around faces.
- Possible values for boxes can be any of the following:
-
Automatic use FindFaces to find the face boxes (default) Full the whole image is assumed to be one face {bbox1,…} a list of bounding boxes for faces - Supported values for TransformationClass include:
-
"Translation" translation only "Rigid" translation and rotation "Similarity" translation, rotation and scaling "Affine" linear transformation and translation (default) - FaceAlign uses machine learning. Its methods, training sets and biases included therein may change and yield varied results in different versions of the Wolfram Language.
- FaceAlign may download resources that will be stored in your local object store at $LocalBase, and that can be listed using LocalObjects[] and removed using ResourceRemove.
Examples
open allclose allBasic Examples (2)
Scope (6)
Automatically detect and align faces in an image:
Specify which reference points are used for the alignment:
Use explicit coordinates as the reference:
Use a face image as the reference:
Specify the size of the output images:
Specify both width and height:
Use the minimum width of the detected faces to specify the size of aligned faces:
Options (6)
Method (2)
By default, the faces are detected automatically:
Use "Method"{"FaceBoxes"boxes} to specify custom bounding boxes:
Use "Method"{"FaceBoxes"Full} to assume that the whole image is a face:
Padding (1)
PaddingSize (1)
By default, the detected bounding box is used to crop the face:
Use PaddingSizen to pad the transformed image with n pixels on each side:
Use PaddingSizeScaled[s] to pad with a fraction s of the image size:
Use negative padding to crop faces:
The padding is applied before the face image is resized to the desired output size:
PerfomanceGoal (1)
By default, FaceAlign returns the result as fast as possible:
Use PerformanceGoal"Quality" to perform a slower, more accurate alignment:
TransformationClass (1)
Use TransformationClass to specify how to perform the alignment:
Properties & Relations (1)
FaceAlign is specifically tuned to detect faces and align them using facial landmarks:
Use ImageAlign to align generic images using corresponding points or other registration techniques:
Text
Wolfram Research (2020), FaceAlign, Wolfram Language function, https://reference.wolfram.com/language/ref/FaceAlign.html (updated 2020).
CMS
Wolfram Language. 2020. "FaceAlign." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/FaceAlign.html.
APA
Wolfram Language. (2020). FaceAlign. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FaceAlign.html