ImageProcessor类的图像抠图并贴图接口,抠图贴图效果示意图请参见图1。
输入抠图参数的四个值推荐均为偶数。除RGB、BGR以外,若包含奇数,则左上角坐标自动向下取偶数,右下角坐标自动向上取偶数。
例如:cropRect{1, 1, 1287, 1287} ,实际抠图宽高为:((1287 + 1) - (1 - 1))= 1288。
APP_ERROR CropAndPaste(const Image& inputImage, const std::pair<Rect, Rect>& cropPasteRect, Image& pastedImage); APP_ERROR CropAndPaste(const Image& inputImage, const std::pair<Rect, Rect>& cropPasteRect, Image& pastedImage, AscendStream& stream);
参数名 |
输入/输出 |
说明 |
---|---|---|
inputImage |
输入 |
输入抠图缩放前的Image类。 Decode接口和其他VPC接口获取的Image类可以直接作为输入。若是用户自定义构造的Image类,则需要设置图像宽高和图像对齐后的宽高。 |
cropPasteRect |
输入 |
输入图像的抠图缩放参数。第一个Rect对应抠图参数,第二个Rect对应贴图参数。 |
pastedImage |
输入/输出 |
输出抠图后的Image类。 |
stream |
输入 |
输入用于异步执行的Stream,具体请参见nottoctopics/zh-cn_topic_0000001662139385.html。 |
数据结构 |
说明 |
---|---|
APP_ERROR |
程序执行返回的错误码,请参考“MxBase/ErrorCode/ErrorCode.h”文件。 |