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

Parameters
  • src[in] Input image data.

  • dst[in] Output image data.

Returns

Return true if transform successfully.

样例
/* 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;