Demo
The arithmetic operator demo operates on two source images to
produce a third resultant image. In this case, the top color image is
combined with a gray scale mask image. When
the buttons are pressed, the resultant image will
be displayed below the source images. Options for
addition, subtraction, multiplication, and division
of two images are activated using the provided
buttons.
JAI
Support is provided for both monadic and dyadic
arithmetic operators. The monadic arithmetic
operations include per-band addition, subtraction,
multiplication, and division between a source image
and a constant value which produce a destination
image. The dyadic arithmetic operations include
per-band addition, subtraction, multiplication,
and division between two source images to produce
a destination image. It is also possible to take
the absolute value of pixels in the source image
and store the results in a destination image.
Exponentiation is also provided.
The arithmetic operations require that both source images and the destination image have the same data type and number of bands. The dimensions of the two images (height and width), however, need not be the same.
When operations are performed, origin locations for each image or single image for monadic operations are aligned. For example, for image addition the value at location 0,0 in one source image is added to location 0,0 of the second source image and the result is stored in location 0,0 of the destination image. This procedure is repeated for every pixel. Arithmetic operations on multi-band images are performed on corresponding bands in the source images.
Theory
Arithmetic operations are used to perform a
pixel by pixel combination of two images. A
single constant may be used to represent a
"constant image."