CropResize

Function Usage

Image cropping and resizing API of the ImageProcessor class. Atlas inference product and Atlas 800I A2 inference product support asynchronous execution. The Image memory allocated using this API does not need to be managed by the user and is released internally. For details about the cropping and resizing effect, see Figure 1.

For details, see Cropping and Resizing.

Figure 1 Cropping and resizing

Prototype

Prototype 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());

Prototype 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());

Prototype 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());

Parameters

Parameter

Input/Output

Description

inputImage

Input

Image class before cropping and resizing.

The Image class obtained by the Decode API and other VPC APIs can be directly used as inputs. If the user-defined Image class is used, set the original and aligned image widths and heights.

inputImageVec

Input

List of the Image class before cropping and resizing (application scenario: image cropping and resizing in a batch).

The Image class obtained by the Decode API and other VPC APIs can be directly used as inputs. If the user-defined Image class is used, set the original and aligned image widths and heights.

cropRectVec

Input

List of cropping parameters. The number must be the same as that of elements in the output image list.

resize

Input

Width and height for resizing.

cropResizeVec

Input

List of cropping and resizing parameters. Rect indicates the coordinates for image cropping and Size indicates the height and width for resizing (application scenario: image cropping and resizing in a batch).

outputImageVec

Output

List of the Image class after cropping (application scenario: image cropping and resizing in a batch).

stream

Input

AscendStream type. The default value is AscendStream::DefaultStream(). When the parameter value is the default value, the API calling is a synchronous operation. In other cases, the API calling is an asynchronous operation.

Response Parameters

Data Structure

Description

APP_ERROR

For details about the returned error codes, see APP_ERROR Description.