0% found this document useful (0 votes)
54 views

3) Arithmetic Operations

The document discusses various arithmetic and logic operations that can be performed on images, including subtraction, addition, AND, OR, and NOT. It provides examples of how subtraction can be used to enhance differences between images and in medical imaging by subtracting a mask image from subsequent images to highlight changes. Image averaging is also introduced as a way to reduce noise by adding multiple noisy images.

Uploaded by

Deepak Gawali
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views

3) Arithmetic Operations

The document discusses various arithmetic and logic operations that can be performed on images, including subtraction, addition, AND, OR, and NOT. It provides examples of how subtraction can be used to enhance differences between images and in medical imaging by subtracting a mask image from subsequent images to highlight changes. Image averaging is also introduced as a way to reduce noise by adding multiple noisy images.

Uploaded by

Deepak Gawali
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

Enhancement Using

Arithmetic/Logic Operations
B.E.Instrumenation
Arithmetic/Logic Operations
• Arithmetic/logic operations - performed on a pixel-by-pixel
basis between two or more images
• This excludes the logic operation NOT, which is performed on
a single image
• E.g., subtraction of two images results in a new image whose
pixel at coordinates (x, y) is the difference between the pixels
in that same location in the two images being subtracted
• AND, OR, and NOT - functionally complete - any other logic
operator can be implemented by using only these three basic
functions
Arithmetic/Logic Operations
• Logic operations on gray-scale images - pixel values are
processed as strings of binary numbers
• E.g., performing the NOT operation on a black, 8-bit pixel (a
string of eight 0’s) produces a white pixel (a string of eight 1’s)
• Intermediate values - same way - changing all 1’s to 0’s and
vice versa
• NOT logic operator – same as the negative transformation
• AND and OR operations - used for masking - for selecting
subimages in an image ( Refer next fig.)
Arithmetic/Logic Operations
Masking using AND and OR operations
Arithmetic/Logic Operations
Masking using AND and OR operations
• AND and OR image masks
– light represents a binary 1
– dark represents a binary 0
• Masking - region of interest (ROI) processing
• In enhancement - masking is used primarily to isolate an area
for processing - to highlight that area and differentiate it from
the rest of the image
• Logic operations - also are used frequently in conjunction with
morphological operations
Arithmetic/Logic Operations
• Arithmetic operations - subtraction and addition (in that
order) are the most useful for image enhancement
• We consider division of two images simply as multiplication of
one image by the reciprocal of the other
• Multiplication
– multiplying an image by a constant to increase its average
gray level
– enhancement - masking operation
• In other words, multiplication of one image by another can be
used to implement gray-level, rather than binary, masks
Arithmetic/Logic Operations
Image Subtraction
• The difference between two images f(x, y) and h(x, y),
expressed as
g(x, y) = f(x, y) - h(x, y)
• obtained by computing the difference between all pairs of
corresponding pixels from f and h
• key usefulness - enhancement of differences between images
• E.g., refer next fig. – Fig a - fractal image
• higher-order bit planes of an image carry a significant amount
of visually relevant detail
• lower planes contribute more to fine (often imperceptible)
detail
Arithmetic/Logic Operations
Image Subtraction: Example
• Figure (b) - result of discarding
(setting to zero) the four least
significant bit planes of the
original image
• The images are nearly identical
visually, with the exception of a
very slight drop in overall contrast
due to less variability of the gray-
level values in the image of Fig.
(b)
• The pixel-by-pixel difference
between these two images is
shown in Fig. (c)

The differences in pixel values are so small that the difference image appears
nearly black when displayed on an 8-bit
In order to bring out more detail, we can perform a contrast stretching
transformation
Arithmetic/Logic Operations
Image Subtraction: Example
• We chose histogram
equalization, but an
appropriate power-law
transformation would
have done the job also.
The result is shown in
Fig.(d)
• This is a very useful image
for evaluating the effect
of setting to zero the
lower-order planes
Arithmetic/Logic Operations
Image Subtraction: Radiography Application
• One of the most commercially successful and beneficial uses of image
subtraction is in the area of medical imaging called mask mode
radiography

• In this case h(x, y), the mask, is an X-ray image of a region of a patient’s
body captured by an intensified TV camera (instead of traditional X-ray
film) located opposite an X-ray source.

• The procedure consists of injecting a contrast medium into the patient’s


bloodstream, taking a series of images of the same anatomical region as
h(x, y), and subtracting this mask from the series of incoming images after
injection of the contrast medium.

• The net effect of subtracting the mask from each sample in the incoming
stream of TV images is that the areas that are different between f(x, y) and
h(x, y) appear in the output image as enhanced detail.
Arithmetic/Logic Operations
Image Subtraction: Radiography Application
Arithmetic/Logic Operations
Image Subtraction: Radiography Application
Arithmetic/Logic Operations
Image Subtraction: Radiography Application

• Because images can be captured at TV rates, this procedure in essence


gives a movie showing how the contrast medium propagates through the
various arteries in the area being observed.
• Figure 3.29(a) shows an X-ray image of the top of a patient’s head prior to
injection of an iodine medium into the bloodstream.
Arithmetic/Logic Operations
Image Subtraction: Radiography Application

The camera yielding this image was positioned above the patient’s
head, looking down. As a reference point, the bright spot in the lower
one-third of the image is the core of the spinal column.
Figure 3.29(b) shows the difference between the mask (Fig. 3.29a)
and an image taken some time after the medium was introduced into
the bloodstream.
Arithmetic/Logic Operations
Image Subtraction: Radiography Application

• The bright arterial paths carrying the medium are


unmistakably enhanced in Fig. 3.29(b).
• These arteries appear quite bright because they are
not subtracted out (that is, they are not part of the
mask image).
Arithmetic/Logic Operations
Image Subtraction: Radiography Application

• The overall background is much darker than that in Fig. 3.29(a)


because differences between areas of little change yield low values,
which in turn appear as dark shades of gray in the difference
image.
• Note, for instance, that the spinal cord, which is bright in Fig.
3.29(a), appears quite dark in Fig. 3.29(b) as a result of subtraction
Arithmetic/Logic Operations
Image Subtraction
• In practice, most images are displayed using 8 bits (even 24-bit
color images consists of three separate 8-bit channels)
• Thus, we expect image values not to be outside the range from 0 to
255
• The values in a difference image can range from a minimum of –255
to a maximum of 255, so some sort of scaling is required to display
the results
• There are two principal ways to scale a difference image.
• One method is to add 255 to every pixel and then divide by 2
• It is not guaranteed that the values will cover the entire 8-bit range
from 0 to 255, but all pixel values definitely will be within this range
Arithmetic/Logic Operations
Image Subtraction
• This method is fast and simple to implement, but it has the limitations that the full
range of the display may not be utilized and, potentially more serious; the
truncation inherent in the division by 2 will generally cause loss in accuracy.
• If more accuracy and full coverage of the 8-bit range are desired, then we can
resort to another approach.
• First, the value of the minimum difference is obtained and its negative added to all
the pixels in the difference image (this will create a modified difference image
whose minimum values is 0).
• Then, all the pixels in the image are scaled to the interval [0, 255] by multiplying
each pixel by the quantity 255_Max, where Max is the maximum pixel value in the
modified difference image.
• It is evident that this approach is considerably more complex and difficult to
implement.
Arithmetic/Logic Operations
Image Subtraction
• Before leaving this section we note also that change
detection via image subtraction finds another major
application in the area of segmentation
• Basically, segmentation techniques attempt to subdivide
an image into regions based on a specified criterion.
• Image subtraction for segmentation is used when the
criterion is “changes”
• For instance, in tracking (segmenting) moving vehicles in a
sequence of images, subtraction is used to remove all
stationary components in an image
• What is left should be the moving elements in the image,
plus noise.
Arithmetic/Logic Operations
Image Averaging
• Consider a noisy image g(x, y) formed by the addition
of noise h(x, y) to an original image f(x, y); that is,
g(x, y) = f(x, y) + h(x, y)
where the assumption is that at every pair of
coordinates (x, y) the noise is uncorrelated and has
zero average value
• The objective of the following procedure is to reduce
the noise content by adding a set of noisy images,
{gi(x, y)}
Arithmetic/Logic Operations
Image Averaging
• If the noise satisfies the constraints, it can be shown that if an
image is formed by averaging K different noisy images,

• then it follows that all at coordinates (x, y),


and

where
• expected value of
• variance of
• variance of
Arithmetic/Logic Operations
Image Averaging : Astronomy
• field of astronomy - imaging
with very low light levels is
routine - causing sensor noise
frequently make images
virtually useless for analysis
• Figure 3.30(a) shows an image
of a galaxy pair called NGC
3314, taken by NASA’s Hubble
Space Telescope with a wide
field planetary camera
Arithmetic/Logic Operations
Image Averaging : Astronomy
• NGC 3314 lies about 140
million light-years from Earth,
in the direction of the
southern-hemisphere
constellation Hydra
• The bright stars forming a
pinwheel shape near the
center of the front galaxy have
formed recently from
interstellar gas and dust
Arithmetic/Logic Operations
Image Averaging : Astronomy
• Figure 3.30(b) shows the same
image, but corrupted by
uncorrelated Gaussian noise with
zero mean and a standard
deviation of 64 gray levels
• This image is useless for all
practical purposes
• Figures 3.30(c) through (f) show
the results of averaging 8, 16, 64,
and 128 images, respectively
• We see that the result obtained
with K=128 is reasonably close to
the original in visual appearance
Arithmetic/Logic Operations
Image Averaging : Astronomy
• We can get a better
appreciation from Fig. 3.31
for how reduction in the
visual appearance of noise
takes place as a function of
increasing K.
• This figure shows the
difference images between
the original [Fig. 3.30(a)]
and each of the averaged
images in Figs. 3.30(c)
through (f)
Arithmetic/Logic Operations
Image Averaging : Astronomy
• The histograms
corresponding to the
difference images are also
shown in the figure
• As usual, the vertical scale
in the histograms represents
number of pixels and is in
the range [0, 2.6*104]
• The horizontal scale
represents gray level and is
in the range [0, 255]
Arithmetic/Logic Operations
Image Averaging : Astronomy
• Notice in the histograms that the
mean and standard deviation of the
difference images decrease as K
increases.
• This is as expected because,
according to Eqs. (3.4-3) and (3.4-4),
the average image should approach
the original as K increases.
• We can also see the effect of a
decreasing mean in the difference
images on the left column of Fig.
3.31, which become darker as the K
increases Addition is the discrete
formulation of continuous
integration.
Arithmetic/Logic Operations
Image Averaging : Astronomy
• In astronomical observations, a
process equivalent to the
method just described is to use
the integrating capabilities of
CCD or similar sensors for noise
reduction by observing the
same scene over long periods of
time.
• The net effect, however, is
analogous to the procedure just
discussed.
• Cooling the sensor further
reduces its noise level.
Arithmetic/Logic Operations
Image Averaging
• As in the case of image subtraction, adding two or more 8-bit
images requires special care when it comes to displaying the result
on an 8-bit display

• The values in the sum of K, 8-bit images can range from 0 to 255*K

• Scaling back to 8 bits in this case consists simply of dividing the


result by K

• Naturally, some accuracy will be lost in the process, but this is


unavoidable if the display has to be limited to 8 bits

• It is possible in some implementations of image averaging to have


negative values when noise is added to an image
Arithmetic/Logic Operations
Image Averaging : Astronomy
• In fact, in the example just given, this was precisely the case
because Gaussian random variables with zero mean and nonzero
variance have negative as well as positive values

• The images in the example were scaled using the second scaling
method discussed at the end of the previous section

• That is, the minimum value in a given average image was obtained
and its negative was added to the image

• Then all the pixels in the modified image were scaled to the range
[0, 255] by multiplying each pixel in the modified image by the
quantity 255_Max, where Max was the maximum pixel value in that
image
Statistical Formulae

You might also like