Class Rotate
Defined in File vision_lite.h
Inheritance Relationships
Base Type
public mindspore::dataset::TensorTransform
(Class TensorTransform)
Class Documentation
-
class Rotate : public mindspore::dataset::TensorTransform
Rotate the input image according to parameters.
Public Functions
-
explicit Rotate(FixRotationAngle angle_id = FixRotationAngle::k0Degree)
Constructor.
- Example
/* Define operations */ auto decode_op = vision::Decode(); auto rotate_op = vision::Rotate(FixRotationAngle::k90Degree); /* dataset is an instance of Dataset object */ dataset = dataset->Map({decode_op, rotate_op}, // operations {"image"}); // input columns
Note
This api is only used in Lite, the interpolation mode is bilinear.
- Parameters
angle_id – [in] The fix rotation angle.
FixRotationAngle::k0Degree = 1, Rotate 0 degree.
FixRotationAngle::k0DegreeAndMirror = 2, Rotate 0 degree and apply horizontal flip.
FixRotationAngle::k180Degree = 3, Rotate 180 degree.
FixRotationAngle::k180DegreeAndMirror = 4, Rotate 180 degree and apply horizontal flip.
FixRotationAngle::k90DegreeAndMirror = 5, Rotate 90 degree and apply horizontal flip.
FixRotationAngle::k90Degree = 6, Rotate 90 degree.
FixRotationAngle::k270DegreeAndMirror = 7, Rotate 270 degree and apply horizontal flip.
FixRotationAngle::k270Degree = 8, Rotate 270 degree.
-
explicit Rotate(float degrees, InterpolationMode resample = InterpolationMode::kNearestNeighbour, bool expand = false, const std::vector<float> ¢er = {}, const std::vector<uint8_t> &fill_value = {0, 0, 0})
Constructor.
- Example
/* Define operations */ auto decode_op = vision::Decode(); auto rotate_op = vision::Rotate(90); /* dataset is an instance of Dataset object */ dataset = dataset->Map({decode_op, rotate_op}, // operations {"image"}); // input columns
- Parameters
degrees – [in] A float value, representing the rotation degrees.
resample – [in] An enum for the mode of interpolation.
InterpolationMode::kLinear, Interpolation method is blinear interpolation.
InterpolationMode::kNearestNeighbour, Interpolation method is nearest-neighbor interpolation.
InterpolationMode::kCubic, Interpolation method is bicubic interpolation.
InterpolationMode::kArea, Interpolation method is pixel area interpolation.
expand – [in] A boolean representing whether the image is expanded after rotation.
center – [in] A float vector of size 2 or empty, representing the x and y center of rotation or the center of the image.
fill_value – [in] A vector representing the value to fill the area outside the transform in the output image. If 1 value is provided, it is used for all RGB channels. If 3 values are provided, it is used to fill R, G, B channels respectively.
-
~Rotate() = default
Destructor.
-
explicit Rotate(FixRotationAngle angle_id = FixRotationAngle::k0Degree)