Python API

This section includes information for using the pure Python API of bob.ip.flandmark.

bob.ip.flandmark.get_config()[source]

Returns a string containing the configuration information.

class bob.ip.flandmark.Flandmark

Bases: object

A key-point localization for faces using Flandmark

This class can be used to locate facial landmarks on pre-detected faces. You input an image and a bounding-box specification and it returns you the positions for multiple key-points for the given face image.

Consult http://cmp.felk.cvut.cz/~uricamic/flandmark/index.php for more information.

Constructor Documentation:

bob.ip.flandmark.Flandmark ([model])

Constructor

Initializes the key-point locator with a model.

Parameters:

model : str (path), optional

Path to the localization model. If not set (or set to None), then use the default localization model, stored on the class variable __default_model__)

Class Members:

locate(image, y, x, height, width) → landmarks

Locates keypoints on a single facial bounding-box on the provided image.This method will locate 8 keypoints inside the bounding-box defined for the current input image, organized in this way:

  1. Face center

  2. Canthus-rl (inner corner of the right eye).

    Note

    The “right eye” means the right eye at the face w.r.t. the person on the image. That is the left eye in the image, from the viewer’s perspective.

  3. Canthus-lr (inner corner of the left eye)

  4. Mouth-corner-r (right corner of the mouth)

  5. Mouth-corner-l (left corner of the mouth)

  6. Canthus-rr (outer corner of the right eye)

  7. Canthus-ll (outer corner of the left eye)

  8. Nose

Each point is returned as tuple defining the pixel positions in the form (y, x).

Parameters:

image : array-like (2D, uint8)

The image Flandmark will operate on

y, x : int

The top left-most corner of the bounding box containing the face image you want to locate keypoints on.

height, width : int

The dimensions accross y (height) and x (width) for the bounding box, in number of pixels.

Returns:

landmarks : array (2D, float64)

Each row in the output array contains the locations of keypoints in the format (y, x)