Function mindspore::dataset::ConvertTo

Function Documentation

bool mindspore::dataset::ConvertTo(const LiteMat &src, LiteMat &dst, double scale = 1.0)

convert the data type, the conversion of currently supports is uint8 to float.

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

LiteMat lite_mat_dst;
ConvertTo(lite_mat_src, 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.

  • dst[in] Output image data.

  • scale[in] Scale pixel value(default:1.0).

Returns

Return true if transform successfully.