Function mindspore::dataset::ConvertRgbToBgr

Function Documentation

bool mindspore::dataset::ConvertRgbToBgr(const LiteMat &src, const LDataType &data_type, int w, int h, LiteMat &mat)

Convert RGB image or color image to BGR image.

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;

ConvertRgbToBgr(lite_mat_src, LDataType::UINT8, width, height, lite_mat_dst);
std::cout << lite_mat_dst.width_ << " " << lite_mat_dst.height_ << " " << lite_mat_dst.channel_ << std::endl;

Parameters
  • src[in] Input image data.

  • data_type[in] The type of data (refer to LDataType class).

  • w[in] The width of output image.

  • h[in] The height of output image.

  • mat[in] Output image data.

Returns

Return true if transform successfully.