Skip to content
class

Rotate

extends_WarpTransform
Rotate(limit: float | tuple[float, float] = 90, interpolation: int | str | Interpolation = 1, border_mode: int = 4, value: float = 0.0, p: float = 0.5)

Rotate by a random angle in [-limit, limit] (Albumentations Rotate).

Parameters

limitfloat or (float, float)= 90
Rotation-angle range in degrees.
interpolationint or str or Interpolation= 1
No description.
border_modeint= 4
OpenCV border code (0 constant, 1 replicate, 2/4 reflect).
valuefloat= 0.0
Constant fill (only used with border_mode=0).
pfloat= 0.5
No description.

Examples

>>> import lucid, lucid.utils.transforms as T
>>> tf = T.Rotate(p=1.0)
>>> tuple(tf(T.Image(lucid.rand(3, 32, 32))).data.shape)
(3, 32, 32)

Used by 1

Constructors

1
dunder

__init__

→None
__init__(limit: float | tuple[float, float] = 90, interpolation: int | str | Interpolation = 1, border_mode: int = 4, value: float = 0.0, p: float = 0.5)

Instance methods

1
fn

make_params

→WarpParams
make_params(img: Tensor)

Sample per-call random parameters for Rotate.

Parameters

Image tensor; its spatial size is read to anchor the rotation about the image centre and to set out_hw.

Returns

WarpParams

Carries the (3, 3) forward pixel-coordinate rotation matrix and out_hw equal to the input (H, W). Angle is sampled uniformly from limit.

Dunder methods

1