class menpo.transform.base.Transformable[source]

Bases: Copyable

Interface for objects that know how to be transformed by the Transform interface.

When Transform.apply_inplace is called on an object, the _transform_inplace() method is called, passing in the transforms’ _apply() function.

This allows for the object to define how it should transform itself.


Apply the given transform function to self inplace.

Parameters:transform (function) – Function that applies a transformation to the transformable object.
Returns:transformed (type(self)) – The transformed object, having been transformed in place.

Generate an efficient copy of this object.

Note that Numpy arrays and other Copyable objects on self will be deeply copied. Dictionaries and sets will be shallow copied, and everything else will be assigned (no copy will be made).

Classes that store state other than numpy arrays and immutable types should overwrite this method to ensure all state is copied.

Returns:type(self) – A copy of this object