Warping¶
Warping is the process of face image normalization. It requires landmarks and face detection to operate. The warp has the following properties:
its size is always 250x250 pixels
it’s always in RGB color format
it always contains just a single face
the face is always centered and rotated so that imaginary line between the eyes is horizontal.
The purpose of the process is to:
compensate image plane rotation (roll angle);
center the image using eye positions;
properly crop the image.
Module for creating warped images
Structure for storing warp.
detection which generated warp
- Type
- Type
Raw warped image.
Properties of a warped image:
its size is always 250x250 pixels
it’s always in RGB color format
it always contains just a single face
the face is always centered and rotated so that imaginary line between the eyes is horizontal.
Validate size and format
- Raises
ValueError("Bad image size for warped image") – if image has incorrect size
ValueError("Bad image format for warped image, must be R8G8B8") – if image has incorrect format
Warning
this checks are not guarantee that image is warp. This function is intended for debug
Load imag from numpy array or file or url.
- Parameters
*_ – for remove positional argument
filename – filename
url – url
- Returns
warp
- Return type
Property for compatibility with Warp for outside methods. :returns: self
- Return type
Class warper.
core warper
- Type
IWarperPtr
Make warp transformation with landmarks
- Parameters
faceDetection – face detection with landmarks5
typeLandmarks – landmarks for warping (“L68” or “L5”)
- Returns
warping landmarks
- Raises
ValueError – if landmarks5 is not estimated
LunaSDKException – if transform failed
- Return type
Union
[Landmarks68
,Landmarks5
]
Create warp from detection.
- Parameters
faceDetection – face detection with landmarks5
- Returns
Warp
- Raises
LunaSDKException – if creation failed
- Return type