Performs padding on the input image and outputs the image to the Image object.
For details about the API, see Padding.
Before calling the padding APIs, prepare the image object to be padded.

Key steps are demonstrated as follows:
Construct an ImageProcessor object and initialize the channel by calling InitVpcChannel(). If you skip this API, ImageProcessor automatically initializes the channel before padding.
Decode the image based on services to generate an Image object that can be padded. Subsequently, the image can be processed by using the image processing APIs to generate a final Image object to be padded.
Construct the input padDim (pixel values to be padded on the top, bottom, left, and right edges), Color (padding color), and output Image based on service requirements.
The following is a code example of key steps of functions and features, which is for reference only and cannot be directly copied for compilation or running.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | // Initialization MxInit(); { // Construct the image processing class. ImageProcessor imageProcessor(deviceId); // Decode the image for Image generation. // Decoded image class Image decodedImage; // Perform decoding based on the image path. APP_ERROR ret = imageProcessor.Decode(imagePath, decodedImage); if (ret != APP_ERR_OK) { std::cout << "Decode failed." << std::endl; } // (Optional) Initialize the image processing channel. imageProcessor.InitVpcChannel(); // Perform padding. // Image class after padding Image paddingImage; // Construct the padding parameters. Dim padDim(0, 0, 240, 240); Color color(0, 0, 0); // Padding ret = imageProcessor.Padding(decodedImage, padDim, color, BorderType::BORDER_CONSTANT, paddingImage); if (ret != APP_ERR_OK) { std::cout << "Padding failed." << std::endl; } } // Deinitialization MxDeInit(); |