compute_features

menpo.fitmultilevel.featurefunctions.compute_features(image, feature_type)[source]

Computes a particular feature representation of the given images.

Parameters:

image : MaskedImage

The original image from which the features will be computed.

feature_type : string or function

If None, no feature representation will be computed from the original image.

If string, the feature representation will be extracted by executing:

feature_image = getattr(image.features, feature_type)()

For this to work properly feature_type needs to be one of Menpo’s standard image feature methods. Note that, in this case, the feature computation will be carried out using its default options.

Non-default feature options and new experimental feature can be used by defining a closure. In this case, the closure must define a function that receives as an input an image and returns a particular feature representation of that image. For example:

def igo_double_from_std_normalized_intensities(image)
    image = deepcopy(image)
    image.normalize_std_inplace()
    return image.feature_type.igo(double_angles=True)

See ImageFeatures for details more details on Menpo’s standard image features and feature options.

Returns:

feature_image : MaskedImage

The resulting feature image.