Operator Reference

zoom_image_sizezoom_image_sizeZoomImageSizeZoomImageSizezoom_image_size (Operator)

zoom_image_sizezoom_image_sizeZoomImageSizeZoomImageSizezoom_image_size — Zoom an image to a given size.

Signature

zoom_image_size(Image : ImageZoom : Width, Height, Interpolation : )

Herror zoom_image_size(const Hobject Image, Hobject* ImageZoom, const Hlong Width, const Hlong Height, const char* Interpolation)

Herror T_zoom_image_size(const Hobject Image, Hobject* ImageZoom, const Htuple Width, const Htuple Height, const Htuple Interpolation)

void ZoomImageSize(const HObject& Image, HObject* ImageZoom, const HTuple& Width, const HTuple& Height, const HTuple& Interpolation)

HImage HImage::ZoomImageSize(Hlong Width, Hlong Height, const HString& Interpolation) const

HImage HImage::ZoomImageSize(Hlong Width, Hlong Height, const char* Interpolation) const

HImage HImage::ZoomImageSize(Hlong Width, Hlong Height, const wchar_t* Interpolation) const   ( Windows only)

static void HOperatorSet.ZoomImageSize(HObject image, out HObject imageZoom, HTuple width, HTuple height, HTuple interpolation)

HImage HImage.ZoomImageSize(int width, int height, string interpolation)

def zoom_image_size(image: HObject, width: int, height: int, interpolation: str) -> HObject

Description

zoom_image_sizezoom_image_sizeZoomImageSizeZoomImageSizezoom_image_size scales the image ImageImageImageimageimage to the size given by WidthWidthWidthwidthwidth and HeightHeightHeightheightheight. The parameter InterpolationInterpolationInterpolationinterpolationinterpolation determines the type of interpolation used (see affine_trans_imageaffine_trans_imageAffineTransImageAffineTransImageaffine_trans_image). The domain of the input image is ignored, i.e., assumed to be the full rectangle of the image.

Attention

If the system parameter 'int_zooming'"int_zooming""int_zooming""int_zooming""int_zooming" is set to 'true'"true""true""true""true", the internally used integer arithmetic may lead to errors in the following three cases: First, if zoom_image_sizezoom_image_sizeZoomImageSizeZoomImageSizezoom_image_size is used on an uint2 or int2 image with high dynamics (i.e. images containing values close to the respective limits) in combination with scale factors (ratio of output to input image size) smaller than 0.5, then the gray values of the output image may be erroneous. Second, if InterpolationInterpolationInterpolationinterpolationinterpolation is set to a value other than 'nearest_neighbor'"nearest_neighbor""nearest_neighbor""nearest_neighbor""nearest_neighbor", a large scale factor is applied, and a large output image is obtained, then undefined gray values at the lower and at the right image border may result. The maximum width of this border of undefined gray values can be estimated as , where S is the scale factor in one dimension and I is the size of the output image in the corresponding dimension. Third, for real images undefined gray values can occur on all image borders, if InterpolationInterpolationInterpolationinterpolationinterpolation is set to 'nearest_neighbor'"nearest_neighbor""nearest_neighbor""nearest_neighbor""nearest_neighbor", and if both the input and output image is large. In all cases, it is recommended to set 'int_zooming'"int_zooming""int_zooming""int_zooming""int_zooming" to 'false'"false""false""false""false" via the operator set_systemset_systemSetSystemSetSystemset_system.

If 'nearest_neighbor'"nearest_neighbor""nearest_neighbor""nearest_neighbor""nearest_neighbor" is set as interpolation method the results can differ slightly for different image types. This is due to the usage of image type specific optimizations of the applied interpolation algorithm.

zoom_image_sizezoom_image_sizeZoomImageSizeZoomImageSizezoom_image_size is not parallelized internally if WidthWidthWidthwidthwidth and HeightHeightHeightheightheight correspond to half the dimensions of ImageImageImageimageimage. Further zoom_image_sizezoom_image_sizeZoomImageSizeZoomImageSizezoom_image_size is not parallelized internally with InterpolationInterpolationInterpolationinterpolationinterpolation='nearest_neighbor'"nearest_neighbor""nearest_neighbor""nearest_neighbor""nearest_neighbor".

zoom_image_sizezoom_image_sizeZoomImageSizeZoomImageSizezoom_image_size can be executed on OpenCL devices if the input image does not exceed the maximum size of image objects of the selected device. Due to numerical reasons, there can be slight differences in the output compared to the execution on the CPU.

Execution Information

  • Supports OpenCL compute devices.
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).
  • Multithreading scope: global (may be called from any thread).
  • Automatically parallelized on tuple level.
  • Automatically parallelized on channel level.
  • Automatically parallelized on internal data level.

Parameters

ImageImageImageimageimage (input_object)  (multichannel-)image(-array) objectHImageHObjectHObjectHobject (byte* / int2* / uint2* / real*) *allowed for compute devices

Input image.

ImageZoomImageZoomImageZoomimageZoomimage_zoom (output_object)  (multichannel-)image(-array) objectHImageHObjectHObjectHobject * (byte / int2 / uint2 / real)

Scaled image.

WidthWidthWidthwidthwidth (input_control)  extent.x HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Width of the resulting image.

Default: 512

Suggested values: 128, 256, 512

Value range: 2 ≤ Width Width Width width width ≤ 512

Minimum increment: 1

Recommended increment: 10

HeightHeightHeightheightheight (input_control)  extent.y HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Height of the resulting image.

Default: 512

Suggested values: 128, 256, 512

Value range: 2 ≤ Height Height Height height height ≤ 512

Minimum increment: 1

Recommended increment: 10

InterpolationInterpolationInterpolationinterpolationinterpolation (input_control)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Type of interpolation.

Default: 'constant' "constant" "constant" "constant" "constant"

List of values: 'bicubic'"bicubic""bicubic""bicubic""bicubic", 'bilinear'"bilinear""bilinear""bilinear""bilinear", 'constant'"constant""constant""constant""constant", 'nearest_neighbor'"nearest_neighbor""nearest_neighbor""nearest_neighbor""nearest_neighbor", 'weighted'"weighted""weighted""weighted""weighted"

Example (HDevelop)

read_image(Image,'monkey')
dev_display (Image)
zoom_image_size(Image,ZoomImage,200,200,'constant')
dev_display (ZoomImage)

Example (C)

read_image(&Image,"monkey");
disp_image(Image,WindowHandle);
zoom_image_size(Image,&ZoomImage,200,200,"constant");
disp_image(ZoomImage,WindowHandle);

Example (HDevelop)

read_image(Image,'monkey')
dev_display (Image)
zoom_image_size(Image,ZoomImage,200,200,'constant')
dev_display (ZoomImage)

Example (HDevelop)

read_image(Image,'monkey')
dev_display (Image)
zoom_image_size(Image,ZoomImage,200,200,'constant')
dev_display (ZoomImage)

Alternatives

zoom_image_factorzoom_image_factorZoomImageFactorZoomImageFactorzoom_image_factor, affine_trans_imageaffine_trans_imageAffineTransImageAffineTransImageaffine_trans_image, hom_mat2d_scalehom_mat2d_scaleHomMat2dScaleHomMat2dScalehom_mat2d_scale

See also

hom_mat2d_scalehom_mat2d_scaleHomMat2dScaleHomMat2dScalehom_mat2d_scale, affine_trans_imageaffine_trans_imageAffineTransImageAffineTransImageaffine_trans_image

Module

Foundation