Class ResizedCrop

Inheritance Relationships

Base Type

Class Documentation

class ResizedCrop : public mindspore::dataset::TensorTransform

Crop the given image and zoom to the specified size.

Public Functions

ResizedCrop(int32_t top, int32_t left, int32_t height, int32_t width, const std::vector<int32_t> &size, InterpolationMode interpolation = InterpolationMode::kLinear)

Constructor.

Note

If the input image is more than one, then make sure that the image size is the same.

Parameters
  • top[in] Horizontal ordinate of the upper left corner of the crop image.

  • left[in] Vertical ordinate of the upper left corner of the crop image.

  • height[in] Height of cropped image.

  • width[in] Width of cropped image.

  • size[in] A vector representing the output size of the image. If the size is a single value, a squared resized of size (size, size) is returned. If the size has 2 values, it should be (height, width).

  • interpolation[in] Image interpolation mode. Default: InterpolationMode::kLinear.

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

样例
/* Define operations */
auto decode_op = vision::Decode();
auto resized_crop_op = vision::ResizedCrop(128, 128, 256, 256, {128, 128});

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

Destructor.