Python API¶
This section includes information for using the pure Python API of
bob.ip.flandmark
.
-
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), optionalPath to the localization model. If not set (or set toNone
), 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:
Face center
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.
Canthus-lr (inner corner of the left eye)
Mouth-corner-r (right corner of the mouth)
Mouth-corner-l (left corner of the mouth)
Canthus-rr (outer corner of the right eye)
Canthus-ll (outer corner of the left eye)
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 ony, x
: intThe top left-most corner of the bounding box containing the face image you want to locate keypoints on, defaults to 0.height, width
: intThe dimensions accrossy
(height) andx
(width) for the bounding box, in number of pixels; defaults to full image resolution.Returns:
landmarks
: array (2D, float64)Each row in the output array contains the locations of keypoints in the format(y, x)
-