class
Affine
extends
_WarpTransformAffine(scale: float | tuple[float, float] = 1.0, translate_percent: float | tuple[float, float] = 0.0, rotate: float | tuple[float, float] = 0.0, shear: float | tuple[float, float] = 0.0, interpolation: int | str | Interpolation = 1, border_mode: int = 4, value: float = 0.0, p: float = 0.5)General affine: scale / translate / rotate / shear (Albumentations Affine).
Parameters
scalefloat or (float, float)= 1.0Uniform scale (sampled if a range).
translate_percentfloat or (float, float)= 0.0Fraction-of-size translation (sampled per axis).
rotatefloat or (float, float)= 0Rotation-angle range in degrees.
shearfloat or (float, float)= 0Shear-angle range in degrees (applied to x).
As in
Rotate.As in
Rotate.As in
Rotate.As in
Rotate.Used by 1
Constructors
1dunder
__init__
→None__init__(scale: float | tuple[float, float] = 1.0, translate_percent: float | tuple[float, float] = 0.0, rotate: float | tuple[float, float] = 0.0, shear: float | tuple[float, float] = 0.0, interpolation: int | str | Interpolation = 1, border_mode: int = 4, value: float = 0.0, p: float = 0.5)Initialise the transform with an empty inverse cache.
Instance methods
1Sample per-call random parameters for Affine.
Parameters
imgTensorImage tensor; its spatial size is read to anchor the warp
and to convert
translate_percent into pixel
translations.Returns
WarpParamsCarries the composed (3, 3) matrix (scale, rotate,
shear-x, translate, anchored at the image centre) and
out_hw equal to the input (H, W).
Notes
The sampled rotation angle is negated when fed to
affine_matrix so Affine agrees with
Rotate on rotation sign.