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:
  • Automaticautomatically align the faces
    faceuse 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:
  • Automaticuse 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:
  • Automaticautomatic choice
    Fulluse the original face size
    swidth and height of size s
    {w,h}explicit width and height
    ffunction 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 Nonehow much padding to leave around the face
    Method Automaticmethod to use
    Padding "Fixed"padding scheme to use
    PerformanceGoal"Speed"aspects of performance to try to optimize
    ResamplingAutomaticresampling 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:
  • dadd 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:
  • Automaticuse FindFaces to find the face boxes (default)
    Fullthe 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 all

Basic Examples  (2)

Get a cropped face from an image aligned with a default reference:

Crop and align multiple faces and conform them to a common size:

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:

Align faces detected from multiple images:

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)

By default, "Fixed" padding is used when at the boundaries:

Use zero padding:

Use "Reversed" padding:

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:

Highlight detected faces:

Compare the result using different transformation classes:

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:

Interactive Examples  (1)

Control the reference points interactively:

Wolfram Research (2020), FaceAlign, Wolfram Language function, https://reference.wolfram.com/language/ref/FaceAlign.html (updated 2020).

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

BibTeX

@misc{reference.wolfram_2024_facealign, author="Wolfram Research", title="{FaceAlign}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/FaceAlign.html}", note=[Accessed: 11-October-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_facealign, organization={Wolfram Research}, title={FaceAlign}, year={2020}, url={https://reference.wolfram.com/language/ref/FaceAlign.html}, note=[Accessed: 11-October-2024 ]}