Function mindspore::dataset::Affine

Function Documentation

bool mindspore::dataset::Affine(LiteMat &src, LiteMat &out_img, const double M[6], std::vector<size_t> dsize, UINT8_C1 borderValue)

Apply affine transformation for 1 channel image.

Parameters
  • src[in] Input image data.

  • out_img[in] Output image data.

  • M[6][in] Affine transformation matrix.

  • dsize[in] The size of the output image.

  • borderValue[in] The pixel value is used for filing after the image is captured.

Returns

Return true if transform successfully.

Example
/* Assume p_rgb is a pointer that points to an image with shape (width, height) */
LiteMat lite_mat_src(width, height, (void *)p_rgb, LDataType::UINT8);
LiteMat lite_mat_src2;
ConvertRgbToGray(lite_mat_src, LDataType::UINT8, width, height, lite_mat_src2);

/* Define Affine matrix and apply */
LiteMat lite_mat_dst;
double M[6] = {1, 0, 0,
               0, 1, 0};
Affine(lite_mat_src2, lite_mat_dst, M, {width, height}, UINT8_C1(0));
std::cout << lite_mat_dst.width_ << " " << lite_mat_dst.height_ << " " << lite_mat_dst.channel_ << std::endl;