Add two images.
The operator add_image adds two images. The gray values (g1,g2) of the input images (Image1 and Image2) are transformed as follows:
g' := (g1 + g2) * Mult + Add
If an overflow or an underflow occurs the values are clipped. This is not the case with int2 images if Mult is equal to 1 and Add is equal to 0. To reduce the runtime the underflow and overflow check is skipped. The resulting image is stored in ImageResult.
It is possible to add byte images with int2, uint2 or int4 images and to add int4 to int2 or uint2 images. In this case the result will be of type int2 or int4 respectively.
Several images can be processed in one call. In this case both input parameters contain the same number of images which are then processed in pairs. An output image is generated for every pair.
Please note that the runtime of the operator varies with different control parameters. For frequently used combinations special optimizations are used. Additionally, for byte, int2, uint2, and int4 images special optimizations are implemented that use SIMD technology. The actual application of these special optimizations is controlled by the system parameter 'mmx_enable' (see set_system). If 'mmx_enable' is set to 'true' (and the SIMD instruction set is available), the internal calculations are performed using SIMD technology.
Note that SIMD technology performs best on large, compact input regions. Depending on the input region and the capabilities of the hardware the execution of add_image might even take significantly more time with SIMD technology than without. In this case, the use of SIMD technology can be avoided by set_system(::'mmx_enable','false':).
|
Image1 (input_object) |
(multichannel-)image(-array) -> object : byte / int1 / int2 / uint2 / int4 / real / direction / cyclic / complex |
| Image(s) 1. | |
|
Image2 (input_object) |
(multichannel-)image(-array) -> object : byte / int1 / int2 / uint2 / int4 / real / direction / cyclic / complex |
| Image(s) 2. | |
|
ImageResult (output_object) |
(multichannel-)image(-array) -> object : byte / int1 / int2 / uint2 / int4 / real / direction / cyclic / complex |
| Result image(s) by the addition. | |
|
Mult (input_control) |
number -> real / integer |
| Factor for gray value adaption. | |
| Default value: 0.5 | |
| Suggested values: 0.2, 0.4, 0.6, 0.8, 1.0, 1.5, 2.0, 3.0, 5.0 | |
| Typical range of values: -255.0 <= Mult <= 255.0 | |
| Minimum increment: 0.001 | |
|
Recommended increment: 0.1 | |
|
Add (input_control) |
number -> real / integer |
| Value for gray value range adaption. | |
| Default value: 0 | |
| Suggested values: 0, 64, 128, 255, 512 | |
| Typical range of values: -512.0 <= Add <= 512.0 | |
| Minimum increment: 0.01 | |
|
Recommended increment: 1.0 | |
read_image(Image0,"fabrik") disp_image(Image0,WindowHandle) read_image(Image1,"Affe") disp_image(Image1,WindowHandle) add_image(Image0,Image1,Result,2.0,10.0) disp_image(Result,WindowHandle)
The operator add_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>:) If necessary an exception handling is raised.
add_image is reentrant and automatically parallelized (on tuple level, channel level, domain level).
Foundation