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_C3 borderValue)

Apply affine transformation for 3 channel image.

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

/* Define Affine matrix and apply */
double M[6] = {1, 0, 20,
               0, 1, 20};
Affine(lite_mat_src, lite_mat_dst, M, {image.cols, image.rows}, UINT8_C3(0, 0, 0));
std::cout << lite_mat_dst.width_ << " " << lite_mat_dst.height_ << " " << lite_mat_dst.channel_ << std::endl;

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.