Scale

menpo.transform.Scale(scale_factor, n_dims=None)[source]

Factory function for producing Scale transforms. Zero scale factors are not permitted.

A UniformScale will be produced if:

  • A float scale_factor and a n_dims kwarg are provided
  • A ndarray scale_factor with shape (n_dims, ) is provided with all elements being the same

A NonUniformScale will be provided if:

  • A ndarray scale_factor with shape (n_dims, ) is provided with at least two differing scale factors.
Parameters:
  • scale_factor (double or (D,) ndarray) – Scale for each axis.
  • n_dims (int) – The dimensionality of the output transform.
Returns:

  • scale (UniformScale or NonUniformScale) – The correct type of scale
  • Raises
  • ——-
  • ValueError – If any of the scale factors is zero