Image Calculator
Contents
Image Calculator
Background
Image Calculator performs arithmetic and logical operations between two images selected from popup menus.
The commands in the main Image Calculator dialog box take the pixel values of Image A, and then add, subtract, multiply, etc. them to the pixel values of Image B. For 2D and 3D images the specified operation is performed on all image slices. Refer to Figure 35.
The advanced dialog options allow performing advanced math operations on both images and also performing math operations on the selected image using the specified constant, e.g. Image A*C, where C is a constant.
clip mode
promotion mode
Promotion sequence:
image types
Image calculator options
Add
Adds the pixel values of Image A to the pixel values of Image B. Basically, this operation adds the colors of the overlay to the background causing the two images ether overflow, or saturate. However, if the added colors excess the color limits, the color will be capped (or clamped) and the result will not necessarily be as you expect.
Image A sample point (255.0,0.0,255.0)
|
Image B (0.0,12.0,255.0)
|
Result= Image A Image B (255.0,12.0,255.0)
|
AND
Does AND of the Image A and the specified Image B. For each pixel in Image A, the Image A pixel value is set to zero, if either the Image A pixel value equals zero, or corresponding Image B pixel value equals zero. Otherwise, the Image A pixel value is left unchanged.
Image A
|
Image B
|
Result=(Image A AND Image B)
|
Average
Average of two images is calculated as (Image A Image B)/2.
Image A
|
Image B
|
(Image A Image B)/2
|
Maximum
RGB values for pixels in the Image A and the corresponding RGB values for the Image B are compared, and then replaced with the greater RGB values. As shown in Figure 26 below, for a chosen point, it took MAX R=12.0 from Image B, MAX G=30.0 from Image A, and MAX B=243.0 from Image A.
Image A, for the selected point RGB is (0.0, 30.0, 243.0)
|
Image B, RGB (12.0, 0.0, 44.0)
|
Result=MAX (Image A, Image B), RGB (12.0, 30.0, 243.0)
|
Minimum
RGB values for pixels in the Image A and the corresponding RGB values for the Image B are compared, and then replaced with the minimum RGB values. As shown in Figure 27 below, for a chosen point, it took MIN R=0.0 from Image A, MIN G=00.0 from Image B, and MIN B=44.0 from Image B.
Image A, for the selected point RGB is (0.0, 30.0, 243.0)
|
Image B, RGB (12.0, 0.0, 44.0)
|
Result=MIN (Image A; Image B), RGB (0.0, 0.0, 44.0)
|
Multiply
Multiplies the Image A pixel values by the Image B pixel values. In clip mode, for RGB images with byte values, results greater than 255 are set to 255. This method works very well if one image (either A, or B) is basically black or gray, or just has a light background, see Figure 28. If both images are color images, then you may get strange results. This technique is also perfect for overlaying line drawings, diagrams or images on an image with very light white or colored background. See also "clip mode".
Image A
|
Image B
|
Image A*Image B
|
Difference
The difference operation is a sequence of two operations. First, a subtraction operation is performed. Then, the absolute value of the result of the subtraction operation is taken. The variation between the colors black and white difference will produce a maximum result of white. However, any colors which are the same will produce black. You can use this function to see where images are similar and where they differ.
Image A
|
Image B
|
Image A-Image B
|
Divide
Divides the pixel values of Image A by the specified Image B. A positive number divided by zero could yield either the maximum positive value, or positive infinity. A negative number divided by zero could yield either the maximum negative value or negative infinity. Zero divided by zero could yield either zero or not a number.
|
|
|- |
|
|
|}