Zoom Image
Use this tool to zoom images by a predefined zoom factor. You can either zoom only a part of an image defined by a region of interest (ROI) or zoom the whole image. Adjust the zoom factor to enlarge or reduce the whole image. You may either use a paraxial rectangle ROI or a rectangle ROI with an arbitrary rotation to define the image part to be zoomed. The graphics window of the tool shows the input image and the possible ROI if used. The zoomed image is automatically used in all subsequent tools.
Parameters
Basic Parameters
Image:
This parameter represents the input image to be zoomed.
If a color image is used as an input image, all channels of the color image are used for the processing.
Zoom Factor:
This parameter defines the factor by which distances in the image are zoomed. As a default, the image is zoomed by a factor of 2, i.e., the edge lengths of the image are doubled and therewith the image area enlarged by factor 4. If no ROI is defined in the image, the zooming is applied on the whole image. To change the factor for the zooming, select the desired "Zoom Factor" at the combo box of the corresponding parameter. The result, a "Zoomed Image", is immediately displayed on the top left corner with its new image size.
|
Value |
Description |
|---|---|
|
< 1 |
Zoom out of the image and thus reduce the image size, but it needs to be > 0. |
|
1 |
Keep the original image size. |
|
2 |
Zoom the image by the factor of 2 and thus enlarge the image area by factor 4. |
|
> 1 |
Zoom into the image and thus enlarge the image size. |
Additional Parameters
ROI:
The parameter "ROI" contains a rectangular ROI that defines the part of the image to be zoomed. By default no ROI is defined. This means that the zooming is applied on the whole image. If you want to use an ROI to define an image part to be zoomed, you either have to connect the parameter to an appropriate ROI result of a previous tool to make sure that an ROI is transmitted to this tool or you have to draw an ROI into the image using the available ROI buttons.
If a rotated ROI is used to define the image part to be zoomed, the resulting image is returned as an axially parallel image.
This tool only supports the use of a single ROI. If the parameter contains multiple ROIs, either from a connection from a previous tool or by drawing multiple ROIs with the ROI buttons, only the last created ROI will be used for the cropping.
Alignment Data:
This parameter represents the alignment data that are used to align the ROI. By default no alignment data are connected and thus no effect is visible. If you want to use specific alignment data, you have to connect the parameter to an appropriate result of a previous tool such as Determine Alignment with Matching, Determine Alignment with Straight Border, Align Image, or Rotate Image.
Destination Width:
This parameter defines the width of the resulting image returned in "Zoomed Image". It is defined in pixels. You may use this parameter if you want to set the image width of the zoomed image to a fixed value.
If the "Destination Width" is set to 0, the parameter "Destination Height" will be ignored. If the "Destination Width" and "Destination Height" are both set to a value different than 0, the image is first zoomed according to the "Zoom Factor". Then the zoomed image is cropped to the new image size defined by the parameters "Destination Width" and "Destination Height". If the zoomed image does not cover the whole area of the new image size, the empty parts are set to the default gray value of 0, i.e., they are displayed in black.
This parameter can also be influenced by the ROI. If a rectangular ROI with an arbitrary rotation is used to define the image part to be zoomed, the parameter "Destination Width" will be ignored as long as the ROI is rotated. Therefore, we recommend that you set the parameter to 0 if the (connected) ROI is likely to be rotated. This ensures that the parameter does not influence the size of the resulting image.
Destination Height:
This parameter defines the height of the resulting image returned in "Zoomed Image". It is defined in pixels. You may use this parameter if you want to set the image height of the zoomed image to a fixed value.
If the "Destination Height" is set to 0, the parameter "Destination Width" will be ignored. If the "Destination Width" and "Destination Height" are both set to a value different than 0, the image is first zoomed according to the "Zoom Factor". Then the zoomed image is cropped to the new image size defined by the parameters "Destination Width" and "Destination Height". If the zoomed image does not cover the whole area of the new image size, the empty parts are set to the default gray value of 0, i.e., they are displayed in black.
This parameter can also be influenced by the ROI. If a rectangular ROI with an arbitrary rotation is used to define the image part to be zoomed, the parameter "Destination Height" will be ignored as long as the ROI is rotated. Therefore, we recommend that you set the parameter to 0 if the (connected) ROI is likely to be rotated. This ensures that the parameter does not influence the size of the resulting image.
Interpolation Method:
This parameter defines the interpolation method that is used to determine the resulting gray values of the zoomed image. Gray-value interpolation is a useful method to enhance the quality of transformed images. As default, the "constant" method is used for the zooming. Select a different method using the combo box of the corresponding parameter.
The table below describes the different interpolation methods with some example images. The example images show the result of the each interpolation method in case the image transformation contains a downscaling or an upscaling of the image. The region of interest (ROI) in the following images shows which image part is visible in the examples for downscaled images (left) and upscaled images (right).
|
Value |
Description |
Example downscaling |
Example upscaling |
|---|---|---|---|
|
bicubic |
This method determines the resulting gray value from 16 neighboring pixels in the original image. Highest quality for upscaling and highest run time |
|
|
|
bilinear |
This method determines the resulting gray value from the four surrounding nearest pixels in the original image. It produces better results with less undesired jagged edges for image transformations that include upscaling but no downscaling. If the image transformation contains a downscaling of the image, this method may lead to undesired artifacts in the image due to aliasing effects. Medium quality and run time |
|
|
|
constant |
This method determines the resulting gray value from the four surrounding nearest pixels in the original image using an equally weighted bilinear interpolation. In contrast to the "bilinear" interpolation this method integrates a smoothing of the image with a mean filter. This leads to a reduction of the undesired aliasing effects in case the image transformation contains a downscaling of the images. Medium quality and run time |
|
|
|
nearest neighbor |
This method determines the resulting gray value based on only one pixel in the original image, i.e., from the gray value of the nearest pixel. This means, no interpolation over multiple pixels is performed. Instead, the resulting pixel is assigned the gray value of the pixel in the original image whose center lies closest to the center of the resulting pixel. Possibly low quality, very fast |
|
|
|
weighted |
This method determines the resulting gray value from the four surrounding nearest pixels in the original image using a Gaussian weighted bilinear interpolation. For this method a Gaussian filter is used in the image transformation for the integrated smoothing of the image. This leads to a better reduction of the aliasing effects in case the image transformation contains a downscaling of the image. Compared to the interpolation method "constant", this method produces output images with a smoother appearance. However, the run time increases significantly for downscaled images. Good quality, slow |
|
|
Results
Basic Results
Zoomed Image:
This result returns the image that has been zoomed by the selected "Zoom Factor".
Tool State:
"Tool State" returns information about the state of the tool and thus can be used for error handling. Please see the topic Tool State Result for more information about the different tool state results.
Additional Results
Processing Time:
This result returns the duration of the most recent execution of the tool in milliseconds. The result is provided as additional result. Therefore, it is hidden by default but it can be displayed via the button beside the tool results. For more information see the section Processing Time in the tool reference overview.
Application Examples
This tool is used in the following MERLIC Vision App examples:
- count_frozen_dough_with_training.mvapp