Function mindspore::dataset::InitFromPixel
- Defined in File image_process.h 
Function Documentation
- 
bool mindspore::dataset::InitFromPixel(const unsigned char *data, LPixelType pixel_type, LDataType data_type, int w, int h, LiteMat &m)
- Init Lite Mat from pixel, the conversion of currently supports is rbgaTorgb and rgbaTobgr. - 说明 - The length of the pointer must be the same as that of the multiplication of w and h. - 参数
- data – [in] Input image data. 
- pixel_type – [in] The type of pixel (refer to enum LPixelType). - LPixelType.BGR, pixel in BGR type. 
- LPixelType.RGB, pixel in RGB type. 
- LPixelType.RGBA, pixel in RGBA type. 
- LPixelType.RGBA2GRAY, convert image from RGBA to GRAY. 
- LPixelType.RGBA2BGR, convert image from RGBA to BGR. 
- LPixelType.RGBA2RGB, convert image from RGBA to RGB. 
- LPixelType.NV212BGR, convert image from NV21 to BGR. 
- LPixelType.NV122BGR, convert image from NV12 to BGR. 
 
- data_type – [in] The type of data (refer to LDataType class). 
- w – [in] The width of the output image. 
- h – [in] The length of the output image. 
- m – [in] Used to store image data. 
 
- 返回
- Return true if transform successfully. 样例
- /* Assume p_rgb is a pointer that points to an image with shape (width, height, channel) */ LiteMat lite_mat_dst; InitFromPixel(p_rgb, LPixelType::RGB, LDataType::UINT8, width, height, lite_mat_dst); std::cout << lite_mat_dst.width_ << " " << lite_mat_dst.height_ << " " << lite_mat_dst.channel_ << std::endl;