Function mindspore::dataset::ExtractChannel

Function Documentation

bool mindspore::dataset::ExtractChannel(LiteMat &src, LiteMat &dst, int col)

Extract image channel by index.

Parameters
  • src[in] Input image data.

  • dst[in] Output image data.

  • col[in] The serial number of the channel.

Returns

Return true if transform successfully.

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;

/* Extract the first channel of image */
ExtractChannel(lite_mat_src, lite_mat_dst, 0);
std::cout << lite_mat_dst.width_ << " " << lite_mat_dst.height_ << " " << lite_mat_dst.channel_ << std::endl;