Scale Image in 2D ROI

Function

Scale the region of ​​interest (ROI) in an image to a specified size.

scale image in 2d roi function description

Usage Scenario

It is usually used for image preprocessing in deep learning related Steps and is usually used with Recover Scaled Images in 2D ROI and deep learning related steps.

Input and Output

scale image in 2d roi input and output

Instruction

This Step is used to scale images in the ROI into a designated size by setting the parameter Color ROI Settings and Ideal Destination Resolution.

Auto Scale

To auto scale the ROI, please follow these steps:

  1. Select the checkbox Auto Scale under Color ROI Settings.

  2. Select the checkbox Same as Input Color ROI & Skip Scaling under Ideal Destination Resolution.

Output Initial ROI Image

To output the initial ROI image, please follow these steps:

  1. Disable Auto Scale under Color ROI Settings.

  2. Set 1 as the value of Customized Scale.

  3. Select the checkbox Same as Input Color ROI & Skip Scaling under Ideal Destination Resolution.

Scale ROI Image by a Particular Degree

To output ROI image of a particular size, please follow these steps:

  1. Disable Auto Scale under Color ROI Settings.

  2. Set Customized Scale according to your need. When the value of this parameter is higher than 1, image will be magnified. If the value is lower than 1, image will be reduced.

  3. Select the checkbox Same as Input Color ROI & Skip Scaling under Ideal Destination Resolution.

Output ROI Image of Designated Width and Height

To out put ROI image of designated width and height, please follow these steps:

  1. Disable the Same as Input Color ROI & Skip Scaling under Ideal Destination Resolution.

  2. Set the value of Width and Height according to your need.

  3. Choose whether to select Padding according to your need.

Please continue your reading to view the description of parameters.

Parameter Description

Color ROI Settings

Description: This parameter decides the way to set color ROI.

Options:

  • ROIByFile: The default setting. Set and identify ROI in a visualize way according to the coordinates of the top left vertex and bottom right vertex.

  • ROIByParam: Set the ROI by configuring the parameters manually, including the coordinate of the top left vertex and the width and height of the ROI.

ROIByFile

Color ROI File

Description: This parameter sets the ROI of color image. Please refer to Set 2D ROI for more information. In the image below, point A is the top left vertex, and B is the bottom right vertex.

scale image in 2d roi roi by file

The coordinate of the upper left corner of the original image is (0, 0).

ROIByParam

Start X

Description: the x-coordinate of the ROI’s top left vertex.

Default value: 0

Instruction: Start X + Width < Initial image width

Start Y

Description: the y-coordinate of the ROI’s top left vertex.

Default value: 0

Instruction: Start Y + Height < Initial image height

Width

Instruction: This parameter refers to the width of the ROI.

Default value: 0

Instruction: Start X + Width < Initial image width

Height

Instruction: This parameter refers to the height of the ROI.

Default value: 0

Instruction: Start Y + Height < Initial image height

scale image in 2d roi roi by param

The coordinate of the upper left corner of the original image is (0, 0).

Method to Update Color ROI

Description: This parameter decides the type of ROI.

Options:

Origin: the initial color image of the ROI.

AdaptivemodifiedRoiOrigin: Use the border of the image to adjust the color ROI and adaptively adjust the center of the non-zero point area of the image to the center of the ROI.

BoundRect: Extract the bounding rectangle area of the input image and replace the original image with the circumscribed rectangle of the non-zero point of the image to calculate the zoom ratio.

Color ROI Scaling

Auto Scale

Description: This parameter automatically adjusts the size of the ROI image.

Default setting: selected.

Customized Scale

Description: This parameter designates the degree to which the ROI is scaled.

Instruction: Scaled image size = Initial ROI size × Customized scaling factor. As shown below, the image on the left is of the initial size, with a customized scaling factor of 0.5.

You can set the parameter only when Auto Scale is not selected.

Ideal Destination Resolution

Same as Input Color ROI & Skip Scaling

Description: This parameter decides whether the size of the image output is set the same as that of the image after Color ROI Scaling setting.

Default setting: unselected.

When this checkbox is not selected, the size of the image output will be scaled.

Width/Height

Description: This parameter sets the width and height of the ROI (in px).

Default value: 1024 px

Tuning recommendation: Please set the parameter according to the actual situation.

You can set the parameter only when Ideal Destination Resolution is not selected.

Padding Color

  • Padding is needed only when the ROI width and height are customized.

  • The value of R, G, and B can be set only when the Padding checkbox is selected.

Padding

Description: This parameter is used to fill the extra space of the ROI when it is scaled up to a particular size.

Default setting: selected.

Instruction: It is recommended to fill the space with black (0,0,0) or grey (128,128,128).

Adjustment Example: The image on the left below is the scaled-up ROI without padding. When padding is used, the size of the ROI image must be designated, and the extra space will be filled up by color, as the image on the right side shows below.

scale image in 2d roi scale filling
R/G/B

Description: Color image is made up of three colors: R, G, and B. Different R/G/B values can fill the image with different colors.

Default value: 0

Value range: 0–255.

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.