mlxtend version: 0.17.0

EyepadAlign

EyepadAlign(verbose=0)

Class to align/transform face images to facial landmarks, based on eye alignment.

  1. A scaling factor is computed based on distance between the left and right eye, such that the transformed face image will have the same eye distance as a reference face image.

  2. A transformation is performed based on the eyes' center point. to align the face based on the reference eye location.

  3. Finally, the transformed image is padded with zeros to match the desired final image size.

Parameters

Attributes

For more usage examples, please see http://rasbt.github.io/mlxtend/user_guide/image/EyepadAlign/

Returns

Methods


fit_directory(target_img_dir, target_height, target_width, file_extension='.jpg', pre_check=True)

Calculates the average landmarks for all face images in a directory which will then be set as the target landmark set.

Arguments

Returns


fit_image(target_image)

Derives facial landmarks from a target image.

Arguments

Returns


fit_values(target_landmarks, target_width, target_height)

Used for determining the eye location from pre-defined landmark arrays, eliminating the need for re-computing the average landmarks on a target image or image directory.

Arguments

Returns


transform(img)

transforms a single face image (img) to the target landmarks based on the location of the eyes by scaling, translation and cropping (if needed):

(1) Scaling the image so that the distance of the two eyes in the given image (img) matches the distance of the two eyes in the target landmarks.

(2) Translation is performed based on the middle point between the two eyes.

Arguments

Returns

extract_face_landmarks

extract_face_landmarks(img, return_dtype=)

Function to extract face landmarks.

Note that this function requires an installation of the Python version of the library "dlib": http://dlib.net

Parameters

Returns

Examples

For usage examples, please see http://rasbt.github.io/mlxtend/user_guide/sources/image/extract_face_landmarks.ipynb