Scale Image in 2D ROI¶
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¶
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:
Select the checkbox Auto Scale under Color ROI Settings.
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:
Disable Auto Scale under Color ROI Settings.
Set 1 as the value of Customized Scale.
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:
Disable Auto Scale under Color ROI Settings.
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.
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:
Disable the Same as Input Color ROI & Skip Scaling under Ideal Destination Resolution.
Set the value of Width and Height according to your need.
Choose whether to select Padding according to your need.
Parameters¶
Color ROI Settings
Description: This parameter decides the way to set color ROI.
List of options:
ROIByFile: The default setting. Set and identify ROI in a visualize way according to the coordinatess 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, B is the bottom right vertex.Hint
The coordinate of the top left vertex of the initial image is (0, 0).
ROIByParam
- Start X
Description: The x-coordinate of the ROI’s top left vertex.Default Value: 0Instruction: Start X + Width < Initial image width- Start Y
Description: The y-coordinate of the ROI’s top left vertex.Default Value: 0Instruction: Start Y + Height < Initial image height- Width
Description: The width of the ROI.Default Value: 0Instruction: Start X + Width < Initial image width- Height
Description: The width of the ROI.Default Value: 0Instruction: Start Y + Height < Initial image heightHint
The coordinate of the top left vertex of the initial image is (0, 0).
- Method to Update Color ROI
- Description: This parameter decides the type of ROI.List of 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.Default Setting: 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.
Hint
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: Selected
Hint
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 Setting: 1024 pxInstruction: Set according to your actual need.
Hint
You can set the parameter only when Ideal Destination Resolution is not selected.
Padding Color
Hint
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 checkbox padding 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.List of Values: SelectedInstruction: 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.
- R / G / B
- Description: Color image is made up of 3 colors: R, G, and B. Different R / G / B values can fill the image with different colors.Default Value: 0Range of Value: 0–255