Function mindspore::dataset::WarpAffineBilinear

Function Documentation

bool mindspore::dataset::WarpAffineBilinear(const LiteMat &src, LiteMat &dst, const LiteMat &M, int dst_w, int dst_h, PaddBorderType borderType, std::vector<uint8_t> &borderValue)

affine image by linear.

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};
LiteMat Matrix(3, 2, M, LDataType::DOUBLE);
std::vector<uint8_t> border_value = {0, 0, 0};
WarpAffineBilinear(lite_mat_src, lite_mat_dst, Matrix, width, height,
                   PaddBorderType::PADD_BORDER_CONSTANT, border_value);
std::cout << lite_mat_dst.width_ << " " << lite_mat_dst.height_ << " " << lite_mat_dst.channel_ << std::endl;

参数
  • src[in] Input image data.

  • dst[in] Output image data.

  • M[in] Transformation matrix

  • dst_w[in] The width of the output image.

  • dst_h[in] The height of the output image.

  • borderType[in] Edge processing type.

    • PaddBorderType.PADD_BORDER_CONSTANT, fills the border with constant values.

    • PaddBorderType.PADD_BORDER_REPLICATE, fills the border with replicate mode.

    • PaddBorderType.PADD_BORDER_REFLECT_101, fills the border with reflect 101 mode.

    • PaddBorderType.PADD_BORDER_DEFAULT, default pad mode, use reflect 101 mode.

  • borderValue[in] Boundary fill value.

返回

Return true if transform successfully.