Crop, Pad, or Resize Images

You are currently viewing the documentation for a pre-release version (2.2.0). To access documentation for other versions, click the "Switch Version" button located in the upper-right corner of the page.

■ If you're unsure about the version of the product you are using, please contact Mech-Mind Technical Support for assistance.

Description

This Step is used to crop, pad, or resize the input image.

Usage Scenario

This Step is widely used for image processing, and there is no specific usage scenario.

Input and Output

Input

Input ports Data type Description

Image

Image

Image to be processed

Alignment parameter group

Pose2D

Used to adjust the feature region’s pose in sync with the target object’s pose changes.

Output

Output ports Data type Description

Processed images

Image / Image[]

Image generated after cropping, padding, or resizing. For padding or resizing, the output is Image. For cropping, if Merge Cropping Results is selected, the output is Image; otherwise, the output is Image[].

Scale parameters

JsonValue

Scale-related information output after padding or resizing, including whether to pad (is_padding) and scale (scale_factor).

For padding, the scaling ratio is 1; for resizing, the scaling ratio is the smaller of Target Width to Original Image Width Ratio and Target Height to Original Image Height Ratio.

ROI parameters

Number[]

The output ROI-related parameter information after padding or resizing. It corresponds to the size of the original image.

Parameter Description

Parameter Description

Operation

This Step is used to select the operation to be performed on the input image, including cropping, padding, or resizing.

  • Crop: Extract a specified region from an image. See Cropping Parameters for detailed parameter adjustment.

  • Filling: Extend the image boundaries. See Padding Parameters for detailed parameter adjustments.

  • Zoom: Adjust the overall size of the image. See Resizing Parameters for details parameter adjustments.

Cropping Parameters

Parameter Description

ROI settings

Set the ROI to determine the cropping range of the image. After the Step is run, only image regions in the ROI will be retained. If the ROI is not set, no cropping is performed.

Merge Crop Results

Once this option is selected, the relative positions of the cropping regions in the original image will be retained, and all the cropping regions will be output in one image.

When this option is not selected, one image will be output per cropping region.

Padding Parameters

Parameter Description

Target width

This parameter is used to set the width (in pixels) of the padded image.

Target height

This parameter is used to set the height (in pixels) of the padded image output.

Pad Color

The R channel padding value used to specify the extended region of the image. If a grayscale image is input, only the value of the R channel takes effect and serves as the grayscale value for padding.

Pad Color (G)

The G-channel padding value used to specify the extended region of the image. Only takes effect when the input is a color image.

Pad Color (B)

The B-channel padding value used to specify the extended region of the image. Only takes effect when the input is a color image.

Scale Parameters

Parameter Description

Lock aspect ratio

Once this option is selected, the ratio of the target width to the target height will be locked, and each time you modify one item, the other item will be automatically scaled.

Target width

This parameter specifies the final width value of the scaled image.

Target height

This parameter specifies the final height value of the scaled image.

Resize after padding

When enabled (default), the image retains its original aspect ratio, scales to fit the target size, and pads any blank areas with black, resulting in no distortion.

When this option is not selected, the image will be stretched or compressed to fit the target size, and the image may be deformed.

Troubleshooting

Filling Operation Not Taking Effect

Symptom:

The target width or height is smaller than the size of the input image, and the padding operation has not taken effect. The size of the output image is the same as the input image.

Possible Cause:

The set target width or height is smaller than or equal to the actual size of the input image, and thus the padding operation cannot be performed.

Solution:

Check and adjust the Target Width and Height parameters to ensure that they are larger than the dimensions of the input image, and then re-run the Step.

Is this page helpful?

You can give a feedback in any of the following ways:

We Value Your Privacy

We use cookies to provide you with the best possible experience on our website. By continuing to use the site, you acknowledge that you agree to the use of cookies. If you decline, a single cookie will be used to ensure you're not tracked or remembered when you visit this website.