scale_image — 缩放图像的灰度值。
scale_image(Image : ImageScaled : Mult, Add : )
The operator scale_image scales the input images
(Image) by the following transformation:
g' := g * Mult + Add
若发生溢出或下溢,数值将被截断。
请注意,循环和方向图像不存在此情况。
This operator can be applied, e.g., to map the gray values of an image, i.e.,
the interval [GMin,GMax], to the maximum range [0:255]. For this, the
parameters are chosen as follows:
The values for GMin and GMax can be determined, e.g., with the operator
min_max_gray.
请注意,算子的运行时间会因不同的控制参数而变化。对于常用组合,会采用特殊的优化方案。此外,还实现了使用定点运算(针对 int2 和 uint2 图像)的特殊优化,以及利用 SIMD 技术(针对 byte、int2 和 uint2 图像)的进一步优化。
The actual application of these special optimizations is controlled by the
system parameters 'int_zooming' and 'mmx_enable'
(see set_system).
If 'int_zooming' is set to 'true', the internal
calculation is performed using fixed point arithmetic, leading
to much shorter execution times. However, the accuracy of the transformed
gray values is slightly lower in this mode. The difference to the more
accurate calculation (using 'int_zooming' = 'false')
is typically less than two gray levels.
If 'mmx_enable' is set to 'true'(and the SIMD
instruction set is available), the internal
calculations are performed using fixed point arithmetic and SIMD technology.
In this case the setting of 'int_zooming' is ignored.
scale_image 可在 OpenCL 设备上执行,适用于 byte、int1、int2、
uint2、int4、real、direction、cyclic 和 complex 图像。然而,由于 OpenCL 1.0 仅支持所有设备使用单精度浮点运算,且并非所有舍入模式均被支持,因此 OpenCL 实现可能会产生与标量或 SIMD 实现略有差异的结果。
请注意,SIMD 技术获得的加速效果在大型、紧凑输入区域上最为显著。然而,在极少数情况下,根据输入区域和硬件性能的不同,使用 SIMD 技术执行
scale_image 可能比不使用时耗时显著增加。在这些情况下,可通过 set_system(::'mmx_enable','false':) 来避免使用 SIMD 技术。
Image (输入对象) (multichannel-)image(-array) → object (byte* / int1* / int2* / uint2* / int4* / int8 / real* / direction* / cyclic* / complex*) *允许用于计算设备
需要缩放灰度值的图像。
ImageScaled (输出对象) (multichannel-)image(-array) → object (byte* / int1* / int2* / uint2* / int4* / int8 / real* / direction* / cyclic* / complex*) *允许用于计算设备
按比例缩放后的图像。
Mult (输入控制) number → (real / integer)
比例系数。
默认值: 0.01
建议值: 0.001, 0.003, 0.005, 0.008, 0.01, 0.02, 0.03, 0.05, 0.08, 0.1, 0.5, 1.0
最小增量: 0.001
建议增量: 0.1
Add (输入控制) number → (real / integer)
偏移量。
默认值: 0
建议值: 0, 10, 50, 100, 200, 500
最小增量: 0.01
建议增量: 1.0
* Complement of the gray values: scale_image(Image,Invert,-1.0,255.0)
如果参数正确,算子 scale_image 返回值 2 (
H_MSG_TRUE)。当输入为空(无可用输入图像)时,其行为通过算子 set_system(::'no_object_result',<Result>:) 进行设置。否则将执行异常处理。
mult_image,
add_image,
sub_image
基础