CropResize

函数功能

ImageProcessor类的图像抠图并缩放接口,Atlas 推理系列产品Atlas 800I A2推理产品支持异步执行,使用该接口申请的Image内存无需用户管理,由内部管理释放,抠图缩放效果示意图请参见图1

相关使用流程请参考抠图缩放

图1 抠图缩放

函数原型

原型1:

1
APP_ERROR ImageProcessor::CropResize(const Image& inputImage, const std::vector<Rect>& cropRectVec, const Size& resize, std::vector<Image>& outputImageVec, AscendStream& stream = AscendStream::DefaultStream());

原型2:

1
APP_ERROR ImageProcessor::CropResize(const Image& inputImage, const std::vector<std::pair<Rect, Size>>& cropResizeVec, std::vector<Image>& outputImageVec, AscendStream& stream = AscendStream::DefaultStream());

原型3:

1
APP_ERROR ImageProcessor::CropResize(const std::vector<Image>& inputImageVec, const std::vector<std::pair<Rect, Size>>& cropResizeVec, std::vector<Image>& outputImageVec, AscendStream& stream = AscendStream::DefaultStream());

参数说明

参数名

输入/输出

说明

inputImage

输入

输入抠图缩放前的Image类。

Decode接口和其他VPC接口获取的Image类可以直接作为输入。若是用户自定义构造的Image类,则需要设置图像宽高和图像对齐后的宽高。

inputImageVec

输入

输入抠图缩放前的Image类列表(针对批量抠图缩放场景)。

Decode接口和其他VPC接口获取的Image类可以直接作为输入。若是用户自定义构造的Image类,则需要设置图像宽高和图像对齐后的宽高。

cropRectVec

输入

输入抠图参数列表,需要与输出图像列表的元素个数一致。

resize

输入

输入统一缩放宽高。

cropResizeVec

输入

输入图像的抠图缩放参数列表。Rect为抠图坐标框,Size为缩放宽高(针对批量抠图缩放场景)。

outputImageVec

输出

输出抠图后的Image类列表(针对批量抠图缩放场景)。

stream

输入

AscendStream类型,默认值为“AscendStream::DefaultStream()”。当参数值为默认值时,接口为同步操作,其他情况下,接口为异步操作。

返回参数说明

数据结构

说明

APP_ERROR

程序执行返回的错误码,请参考APP_ERROR说明