Uploaded by hamzafareed100

Lecture-4--Week-4--04042021-090920am

advertisement
Digital image processing
Lecture 5
• The smallest possible neighborhood is of size 1 × 1.
• In this case, g depends only on the value of f at a single point (x, y)
and T transformation function.
• where, for simplicity in notation, we use s and r to denote,
respectively, the intensity of g and f at any point (x, y).
Basic Spatial Domain Image Enhancement
•Most spatial domain enhancement operations can be
reduced to the form
•g (x, y) = T[ f (x, y)]
Origin
•where f (x, y) is the
input image, g (x, y) is
the processed image
and T is some
operator defined over
some neighbourhood
of (x, y)
y
Image f (x, y)
x
(x, y)
• The transfer function in Fig (a) is used
for contrast stretching
• The transfer function in fig (b) is used
for thresholding.
• Approaches whose results depend
only on the intensity at a point
sometimes are called point
processing techniques.
Point Processing Example:
Thresholding (cont…)
Original Image
y
Image f (x, y)
s=
Enhanced Image
x
y
Image f (x, y)
1.0 r > threshold
0.0 r <= threshold
x
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Point Processing Example:
Thresholding
•Thresholding transformations are particularly useful for segmentation
in which we want to isolate an object of interest from a background
s=
1.0 r > threshold
0.0 r <= threshold
Thresholding example
• Two ways to implement
the thresholding
operation
• Comparison
• Look up table (LUT)
Image Enhancement
• Enhancement is the process of manipulating an image so that the
result is more suitable than the original for a specific application.
• The word specific is important, because it establishes at the outset
that enhancement techniques are problem-oriented.
SOME BASIC INTENSITY TRANSFORMATION
FUNCTIONS
• linear (negative and identity transformations),
• logarithmic (log and inverse-log transformations),
• power-law (nth power and nth root transformations).
• The identity function is the trivial case in which the input and output
intensities are identical.
IMAGE NEGATIVES
• The negative of an image with
intensity levels in the range [0,L − 1]
is obtained by using the negative
transformation function shown in
Fig.
• Take image negative using matlab…
Logarithmic Transformations
•The general form of the log transformation is
•s = c * log(1 + r)
•The log transformation maps a narrow range of low input grey level
values into a wider range of output values
•The inverse log transformation performs the opposite transformation
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Logarithmic Transformations (cont…)
•Log functions are particularly useful when the input
grey level values may have an extremely large range of
values
•In the following example the Fourier transform of an
image is put through a log transform to reveal more
detail
s = log(1 + r)
LOG TRANSFORMATIONS
• The general form of the log transformation in Fig.
• where c is a constant and it is assumed that r ≥ 0.
• The shape of the log curve in Fig. shows that this
transformation maps a narrow range of low
intensity values in the input into a wider range of
output levels.
• For example, note how input levels in the range
[0, L 4] map to output levels to the range [0, 3L 4].
• Conversely, higher values of input levels are
mapped to a narrower range in the output.
• We use a transformation of this type to expand
the values of dark pixels in an image, while
compressing the higher-level values. The opposite
is true of the inverse log (exponential)
transformation.
• The log function has the important characteristic
that it compresses the dynamic range of pixel
values.
• Perform log transformation on Matlab
POWER-LAW (GAMMA) TRANSFORMATIONS
• Power-law transformations have the form
• where c and g are positive constants.
• Figure 3.6 shows plots of s as a function of r
for various values of g.
• Power-law curves with fractional values of
g map a narrow range of dark input values
into a wider range of output values, with
the opposite being true for higher values of
input levels.
• Curves generated with values of g > 1 have
exactly the opposite effect as those
generated with values of g < 1.
• When c = g = 1 Eq. (3-5) reduces to the
identity transformation.
• Perform gamma transformation on matlab
• Figure 3.8(a) shows a magnetic resonance image (MRI)
of a human upper thoracic spine with a fracture
dislocation.
• The fracture is visible in the region highlighted by the
circle. Because the image is predominantly dark, an
expansion of intensity levels is desirable.
• This can be accomplished using a power-law
transformation with a fractional exponent.
• Observe that as gamma decreased from 0.6 to 0.4,
more detail became visible.
• A further decrease of gamma to 0.3 enhanced a little
more detail in the background, but began to reduce
contrast to the point where the image started to have a
very slight “washed-out” appearance, especially in the
background.
• The best enhancement in terms of contrast and
discernible detail was obtained with g = 0 .4.
• A value of g = 0.3 is an approximate limit below which
contrast in this particular image would be reduced to
an unacceptable level.
• Perform using matlab.
(b)–(d) Results of applying the transformation using
power law with c = 1 and g = 0.6, 0.4, and 0.3,
respectively.
• Figure 3.9(a) shows the opposite
problem of that presented in Fig.
3.8(a).
• The image to be processed now has a
washed-out appearance, indicating
that a compression of intensity levels
is desirable.
• This can be accomplished with power
law, using values of g greater than 1.
• The results of processing Fig. 3.9(a)
with g = 3.0, 4.0, and 5.0 are shown in
Figs. 3.9(b) through (d), respectively.
• Perform using Matlab
Quantization Artifacts
Dither Signal
• Reduce quantization error by adding uniformly distributed white
noise (dither signal) prior to quantization.
• Dither hides objectionable artifacts
• To each pixel in the image add a random number in the range [-m, m],
where m is MXGRAY/quantization levels
PIECEWISE LINEAR TRANSFORMATION
FUNCTIONS
• The advantage of piecewise functions is that the form of piecewise
functions can be arbitrarily complex.
• The main disadvantage of these functions is that their specification
requires considerable user input.
• Contrast Stretching
• Low-contrast images can result from
• poor illumination
• lack of dynamic range in the imaging sensor
• the wrong setting of a lens aperture during image acquisition
• Contrast stretching expands the range of intensity levels in an image so that it
spans the ideal full intensity range of the recording medium or display device.
• Figure 3.10(a) shows a typical transformation used for
contrast stretching.
• The locations of points (r1 , s1 ) and (r2 , s2 ) control
the shape of the transformation function.
• If r1=s1and r2=s2 the transformation is a linear
function that produces no changes in intensity. If r1
=r2, s1 = 0, and s2=L − 1 the transformation becomes a
thresholding function that creates a binary image.
• Intermediate values of (r1 , s1 ) and (s2, r2 ) produce
various degrees of spread in the intensity levels of the
output image, thus affecting its contrast.
• In general, r1 ≤ r2 and s1 ≤ s2 is assumed so that the
function is single valued and monotonically increasing.
This preserves the order of intensity levels, thus
preventing the creation of intensity artifacts.
• Figure 3.10(b) shows an 8-bit image with low contrast.
• Figure 3.10(c) shows the result of contrast stretching,
obtained by setting (r1 ,s1 )= (r_ min ,0 ) and (r2 ,s2 )=
(r_max , L-1).
• Where r_min and r_max denote the minimum and
maximum intensity levels in the input image.
• Figure 3.10(d) shows result of thresholding
Download