Class RandomRotation

Inheritance Relationships

Base Type

Class Documentation

class RandomRotation : public mindspore::dataset::TensorTransform

Rotate the image according to parameters.

Public Functions

explicit RandomRotation(const std::vector<float> &degrees, InterpolationMode resample = InterpolationMode::kNearestNeighbour, bool expand = false, const std::vector<float> &center = {}, const std::vector<uint8_t> &fill_value = {0, 0, 0})

Constructor.

Parameters
  • degrees[in] A float vector of size 2, representing the starting and ending 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.

    • InterpolationMode::kCubicPil, Interpolation method is bicubic interpolation like implemented in pillow.

  • 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.

样例
/* Define operations */
auto decode_op = vision::Decode();
auto random_op = vision::RandomRotation({30, 60}, InterpolationMode::kNearestNeighbour);

/* dataset is an instance of Dataset object */
dataset = dataset->Map({decode_op, random_op},  // operations
                       {"image"});              // input columns
~RandomRotation() = default

Destructor.