ImageProcessor类的图片解码接口,使用该接口申请的Image内存无需用户管理,由内部管理释放。仅支持以Host侧申请的内存作为解码接口的输入。输入图片内存的数据类型目前支持JPEG和PNG两种格式。
APP_ERROR Decode(const std::shared_ptr<uint8_t> dataPtr, const uint32_t dataSize, Image& outputImage, const ImageFormat decodeFormat = ImageFormat::YUV_SP_420); APP_ERROR Decode(const std::string inputPath, Image& outputImage, const ImageFormat decodeFormat = ImageFormat::YUV_SP_420);
参数名 |
输入/输出 |
说明 |
---|---|---|
dataPtr |
输入 |
输入待解码图片数据的内存地址。解码前图像数据内存地址需要用户进行管理。 |
dataSize |
输入 |
输入待解码图片数据的内存大小。需要与“dataPtr”的实际内存大小相符。 |
decodeFormat |
输入 |
输入解码后图片的格式。
|
inputPath |
输入 |
输入待解码的图片路径。 |
outputImage |
输出 |
输出解码后的Image类。 图片宽高和对齐后的宽高会自动合入进“outputImage”内。 |
数据结构 |
说明 |
---|---|
APP_ERROR |
程序执行返回的错误码,请参考“MxBase/ErrorCode/ErrorCode.h”文件。 |