zoom_image_factorzoom_image_factorZoomImageFactorZoomImageFactorzoom_image_factor (算子)

名称

zoom_image_factorzoom_image_factorZoomImageFactorZoomImageFactorzoom_image_factor — 按给定系数缩放图像。

签名

zoom_image_factor(Image : ImageZoomed : ScaleWidth, ScaleHeight, Interpolation : )

Herror zoom_image_factor(const Hobject Image, Hobject* ImageZoomed, double ScaleWidth, double ScaleHeight, const char* Interpolation)

Herror T_zoom_image_factor(const Hobject Image, Hobject* ImageZoomed, const Htuple ScaleWidth, const Htuple ScaleHeight, const Htuple Interpolation)

void ZoomImageFactor(const HObject& Image, HObject* ImageZoomed, const HTuple& ScaleWidth, const HTuple& ScaleHeight, const HTuple& Interpolation)

HImage HImage::ZoomImageFactor(double ScaleWidth, double ScaleHeight, const HString& Interpolation) const

HImage HImage::ZoomImageFactor(double ScaleWidth, double ScaleHeight, const char* Interpolation) const

HImage HImage::ZoomImageFactor(double ScaleWidth, double ScaleHeight, const wchar_t* Interpolation) const   ( Windows only)

static void HOperatorSet.ZoomImageFactor(HObject image, out HObject imageZoomed, HTuple scaleWidth, HTuple scaleHeight, HTuple interpolation)

HImage HImage.ZoomImageFactor(double scaleWidth, double scaleHeight, string interpolation)

def zoom_image_factor(image: HObject, scale_width: float, scale_height: float, interpolation: str) -> HObject

描述

zoom_image_factorzoom_image_factorZoomImageFactorZoomImageFactorZoomImageFactorzoom_image_factor scales the image ImageImageImageImageimageimage by a factor of ScaleWidthScaleWidthScaleWidthScaleWidthscaleWidthscale_width in width and a factor ScaleHeightScaleHeightScaleHeightScaleHeightscaleHeightscale_height in height. The parameter InterpolationInterpolationInterpolationInterpolationinterpolationinterpolation determines the type of interpolation used (see affine_trans_imageaffine_trans_imageAffineTransImageAffineTransImageAffineTransImageaffine_trans_image). The domain of the input image is ignored, i.e., assumed to be the full rectangle of the image.

注意

If the system parameter 'int_zooming'"int_zooming""int_zooming""int_zooming""int_zooming""int_zooming" is set to 'true'"true""true""true""true""true", the internally used integer arithmetic may lead to errors in the following three cases: First, if zoom_image_factorzoom_image_factorZoomImageFactorZoomImageFactorZoomImageFactorzoom_image_factor 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 smaller than 0.5, then the gray values of the output image may be erroneous. Second, if InterpolationInterpolationInterpolationInterpolationinterpolationinterpolation is set to a value other than 'nearest_neighbor'"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 InterpolationInterpolationInterpolationInterpolationinterpolationinterpolation is set to 'nearest_neighbor'"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""int_zooming" to 'false'"false""false""false""false""false" via the operator set_systemset_systemSetSystemSetSystemSetSystemset_system

If 'nearest_neighbor'"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_factorzoom_image_factorZoomImageFactorZoomImageFactorZoomImageFactorzoom_image_factor is not parallelized internally if ScaleWidthScaleWidthScaleWidthScaleWidthscaleWidthscale_width = 0.5 and ScaleHeightScaleHeightScaleHeightScaleHeightscaleHeightscale_height = 0.5. Further zoom_image_factorzoom_image_factorZoomImageFactorZoomImageFactorZoomImageFactorzoom_image_factor is not parallelized internally with InterpolationInterpolationInterpolationInterpolationinterpolationinterpolation='nearest_neighbor'"nearest_neighbor""nearest_neighbor""nearest_neighbor""nearest_neighbor""nearest_neighbor".

zoom_image_factorzoom_image_factorZoomImageFactorZoomImageFactorZoomImageFactorzoom_image_factor 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.

执行信息

参数

ImageImageImageImageimageimage (输入对象)  (multichannel-)image(-array) objectHImageHObjectHImageHobject (byte* / int2* / uint2* / real*) *允许用于计算设备

输入图像。

ImageZoomedImageZoomedImageZoomedImageZoomedimageZoomedimage_zoomed (输出对象)  (multichannel-)image(-array) objectHImageHObjectHImageHobject * (byte / int2 / uint2 / real)

Scaled image.

ScaleWidthScaleWidthScaleWidthScaleWidthscaleWidthscale_width (输入控制)  extent.x HTuplefloatHTupleHtuple (real) (double) (double) (double)

Scale factor for the width of the image.

默认值: 0.5

建议值: 0.25, 0.5, 1.5, 2.0

值范围: 0.001 ≤ ScaleWidth ScaleWidth ScaleWidth ScaleWidth scaleWidth scale_width ≤ 10.0

最小增量: 0.001

建议增量: 0.1

ScaleHeightScaleHeightScaleHeightScaleHeightscaleHeightscale_height (输入控制)  extent.y HTuplefloatHTupleHtuple (real) (double) (double) (double)

Scale factor for the height of the image.

默认值: 0.5

建议值: 0.25, 0.5, 1.5, 2.0

值范围: 0.001 ≤ ScaleHeight ScaleHeight ScaleHeight ScaleHeight scaleHeight scale_height ≤ 10.0

最小增量: 0.001

建议增量: 0.1

InterpolationInterpolationInterpolationInterpolationinterpolationinterpolation (输入控制)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

插值类型。

默认值: 'constant' "constant" "constant" "constant" "constant" "constant"

值列表: 'bicubic'"bicubic""bicubic""bicubic""bicubic""bicubic", 'bilinear'"bilinear""bilinear""bilinear""bilinear""bilinear", 'constant'"constant""constant""constant""constant""constant", 'nearest_neighbor'"nearest_neighbor""nearest_neighbor""nearest_neighbor""nearest_neighbor""nearest_neighbor", 'weighted'"weighted""weighted""weighted""weighted""weighted"

示例(HDevelop)

read_image(Image,'monkey')
dev_display (Image)
zoom_image_factor (Image, ZoomImage, 0.25, 0.25, 'constant')
dev_display (ZoomImage)

示例(C)

read_image(&Image,"monkey");
disp_image(Image,WindowHandle);
zoom_image_factor(Image,&ZooImage,0.25,0.25,"constant");
disp_image(ZooImage,WindowHandle);

示例(HDevelop)

read_image(Image,'monkey')
dev_display (Image)
zoom_image_factor (Image, ZoomImage, 0.25, 0.25, 'constant')
dev_display (ZoomImage)

示例(HDevelop)

read_image(Image,'monkey')
dev_display (Image)
zoom_image_factor (Image, ZoomImage, 0.25, 0.25, 'constant')
dev_display (ZoomImage)

示例(HDevelop)

read_image(Image,'monkey')
dev_display (Image)
zoom_image_factor (Image, ZoomImage, 0.25, 0.25, 'constant')
dev_display (ZoomImage)

替代

zoom_image_sizezoom_image_sizeZoomImageSizeZoomImageSizeZoomImageSizezoom_image_size, affine_trans_imageaffine_trans_imageAffineTransImageAffineTransImageAffineTransImageaffine_trans_image, hom_mat2d_scalehom_mat2d_scaleHomMat2dScaleHomMat2dScaleHomMat2dScalehom_mat2d_scale

另见

hom_mat2d_scalehom_mat2d_scaleHomMat2dScaleHomMat2dScaleHomMat2dScalehom_mat2d_scale, affine_trans_imageaffine_trans_imageAffineTransImageAffineTransImageAffineTransImageaffine_trans_image

模块

基础