Scale the gray values of an image.
The operator scale_image scales the input images (Image) by the following transformation:
g' := g * Mult + Add
If an overflow or an underflow occurs the values are clipped.
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:
Mult = 255 / (GMax-GMin) Add = - Mult*GMin
The values for GMin and GMax can be determined, e.g., with the operator
min_max_gray.
Please note that the runtime of the operator varies with different control parameters. For frequently used combinations special optimizations are used. Additionally, special optimizations are implemented that use fixed point arithmetic (for int2 and uint2 images), and further optimizations that use SIMD technology (for byte, int2, and uint2 images). The actual application of these special optimizations is controlled by the system parameters 'int_zooming' and 'mmx_available' (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_available' 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.
Note that the acceleration gained by SIMD technology is highest on large, compact input regions. However, in rare cases, the execution of scale_image might take significantly longer with SIMD technology than without, depending on the input region and the capabilities of the hardware. In these cases, the use of SIMD technology can be avoided by set_system(::'mmx_enable','false':).
|
Image (input_object) |
(multichannel-)image(-array) -> object : byte / int1 / int2 / uint2 / int4 / real / direction / cyclic / complex |
| Image(s) whose gray values are to be scaled. | |
|
ImageScaled (output_object) |
(multichannel-)image(-array) -> object : byte / int1 / int2 / uint2 / int4 / real / direction / cyclic / complex |
| Result image(s) by the scale. | |
|
Mult (input_control) |
number -> real / integer |
| Scale factor. | |
| Default value: 0.01 | |
| Suggested values: 0.001, 0.003, 0.005, 0.008, 0.01, 0.02, 0.03, 0.05, 0.08, 0.1, 0.5, 1.0 | |
| Minimum increment: 0.001 | |
|
Recommended increment: 0.1 | |
|
Add (input_control) |
number -> real / integer |
| Offset. | |
| Default value: 0 | |
| Suggested values: 0, 10, 50, 100, 200, 500 | |
| Minimum increment: 0.01 | |
|
Recommended increment: 1.0 | |
/* Complement of the gray values: */ scale_image(Bild,Invert,-1.0,255.0,)
The operator scale_image returns the value 2 (H_MSG_TRUE) if the parameters are correct. The behavior in case of empty input (no input images available) is set via the operator set_system(::'no_object_result',<Result>:) Otherwise an exception treatment is carried out.
scale_image is reentrant and automatically parallelized (on tuple level, channel level, domain level).
mult_image, add_image, sub_image
Foundation