Padding

The Atlas 200/300/500 inference product is not supported.

Function Usage

Image padding API of the ImageProcessor class. The memory allocated by this API does not need to be managed or destroyed by users.

For details, see Padding.

  • Formats of the input and output Image class can be YUV_SP_420, YVU_SP_420, RGB_888 and BGR_888 (nv12, nv21, rgb, and bgr). The resolution of an RGB (BGR) image cannot exceed 4096 x 4096.
  • The actual inputImage resolution range is [18 x 6, 4096 x 4096].
  • Only the BORDER_CONSTANT padding method is supported. Other padding methods are reserved. For YUV_SP_420 and YVU_SP_420 formats, it is recommended that the padding size be an even number. If the padding size is an odd number, upward alignment is automatically performed. For example, if the padding size entered by the user is (1, 1, 1, 1), it is automatically aligned to (2, 2, 2, 2), which means two pixels are padded to the top, bottom, left, and right borders respectively. When the input image size is 4095 x 4095 and the padding size is (1, 0, 1, 0), the image size after automatic alignment is 4097 x 4097, which is out of the padding size range. As a result, padding fails.
  • outputImage: The width is automatically aligned by 16, and the height is automatically aligned by 2. So the size range is [32 x 6, 4096 x 4096].

Prototype

1
APP_ERROR ImageProcessor::Padding(const Image& inputImage, Dim &padDim, const Color& color, const BorderType borderType, Image& outputImage);

Parameters

Parameter

Input/Output

Description

inputImage

Input

Input Image class before padding. 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.

padDim

Input

Padding size of the input image.

color

Input

Input 3-channel color values for padding. This parameter is valid only when borderType is set to BORDER_CONSTANT.

borderType

Input

Input padding method. For details, see BorderType.

outputImage

Output

Image class after padding.

Response Parameters

Data Structure

Description

APP_ERROR

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