Function mindspore::dataset::HWC2CHW

Function Documentation

bool mindspore::dataset::HWC2CHW(LiteMat &src, LiteMat &dst)

Transpose the input image; shape (H, W, C) to shape (C, H, W).

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

HWC2CHW(lite_mat_src, lite_mat_dst);
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.

返回

Return true if transform successfully.