UNIT-2 Image Enhancement (Updated)
UNIT-2 Image Enhancement (Updated)
1. Spatial domain:-
1
Spatial domain refers to the image plane itself, and approaches in this category are
based on direct manipulation of pixels in an image.
Where,
f(x, y) - input image,
g(x, y) - processed image
T - Operator on f, defined over some neighborhood of (x, y).
The neighborhood about a point (x, y) is to use a square or rectangular sub image area
centered at (x, y)
The center of sub image is moved from pixel to pixel starting at the top left
corner. The operator T is applied to each location (x,y) to find the output g at
that location . The process utilizes only the pixel in the area of the image
spanned by the neighborhood.
2
(a) (b)
Image enhancement can be done through gray level transformations which are
discussed below.
1. Linear transformation
1. Image Negative:-
The negative of an image with gray levels in the range [0, L-1] is obtained by using the
negative transformation.
S=L–1-r
Where r= gray level value at pixel (x,y)
L is the largest gray level consists in the image
3
i. If r=0, S = L – 1
ii. If r=L – 1, S = 0
This type of processing is particularly suited for enhancing white or gray detail embedded in dark
regions of an image, especially when the black areas are dominant in size.
2. Logarithmic transformations
a) Log Transformations:
The log transformations can be defined by this formula
s = c log (1 + r)
Where S and r are the pixel values of the output and the input image and c is a
constant and it is assumed that r ≥ 0
During log transformation, the dark pixels in an image are expanded as compare to the
higher pixel values. The higher pixel values are kind of compressed in log
transformation. This result in following image enhancement
4
3. Power-Law Transformations
Power-law transformations have the basic form
s = c ry
Where c and γ are positive constants. Also can be represented as
s = c (r+ε) y
This symbol γ is called gamma
We use gamma transformation where we need to expand or compress darker region
i. If γ = 1, No change
ii. If γ > 1, compresses dark values and expands bright values
iii. If γ < 1, expands dark values Compresses bright values
5
Power law curves with fractional values of y 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 gray levels. We may get various curves by varying values of y.
Piecewise-Linear Transformations
1. Contrast Stretching
It is the simplest piecewise linear transformation function
The idea behind contrast stretching is to increase the dynamic range of
gray levels in the image being processed.
6
2. Gray-level Slicing
Gray level slicing is used to Highlighting a specific range of gray levels in an image.
(1) One method is to display a high value for all gray level in the range of interest and
a low value for all other gray level
(2) Second method is to brighten the desired ranges of gray levels but preserve the
background and gray level tonalities in the image.
7
3. Bit-plane Slicing
Highlighting the contribution made to total image appearance by specific bits
might be desired.
It is useful in image compression.
Suppose that each pixel in an image is represented by 8 bits. Imagine that the image is
composed of eight 1-bit planes, ranging from bit-plane 0 for the least significant bit to
bit plane 7 for the most significant bit. In terms of 8-bit bytes, plane 0 contains all the
lowest order bits in the bytes comprising the pixels in the image and plane 7 contains
all the high-order bits.
Example 1:- find the bit planes of given 3x3 image
Solution:
8
Example 2: find the bit planes of given 3x3 image
Histogram Processing
The histogram of a digital image with gray levels in the range [0, L-1] is a discrete
function
h(rk)=nk
Where rk is the kth gray level and nk is the number of pixels in the image having gray
level rk.
9
Histogram Equalization
Histogram equalization is a technique for enhancing the appearance of images.
10
Solution: based on above table histogram of input image
11
12
Figure: Processed histogram
So, that
Example:
13
Processed Histogram
14
Question:
Ans: No
15
16
Normalized hitogram
17
Basics of Spatial Filtering
Filter term in “image processing” is referred to the subimage
This sub image is called a filter, mask, kernel, template or window;
The values in the filter sub image are referred to as coefficients rather than
pixel. Spatial filtering operations are performed directly on the pixels values
of the image
The process consists of moving the filter mask from point to point in the image.
The filter mask may be 3x3 mask or 5x5 mask or to be 7x7 mask.
18
Types of Smoothing Spatial Filter:
There are two way of smoothing special filters
1. Smoothing Linear Filters:
2. Order Statistics Filters[Non-linear]:-
a) Averaging/mean filter:
A spatial averaging filter in which all coefficients are equal is sometimes
referred to as a “box filter”
Example:
19
2. Order Statistics Filter:-
Median filter
In this filter the values of the center pixel is replaced by median of gray levels in the
neighborhood of that pixel.
These filters are particularly effective in the case of impulse or salt and pepper noise.
Example
Max filters
This filter is useful for finding the brightest points in an image.
Min filters
This filter is useful for finding the darkest points in an image.
20
Example:
21
22
23
24
Sharpening Spatial filters [high pass filter]:
25
The Laplacian for a two dimensional function f(x,y) is defined as
Where,
The equation can be represented using any one of the following masks
26
Solutions:
27
In the frequency domain, a digital image is converted from spatial domain to
frequency domain. In the frequency domain, image filtering is used for image
enhancement for a specific application. A Fast Fourier transformation is a tool of the
frequency domain used to convert the spatial domain to the frequency domain. For
smoothing an image, low filter is implemented and for sharpening an image, high pass
filter is implemented. When both the filters are implemented, it is analyzed for the
ideal filter, Butterworth filter and Gaussian filter
28
Frequency Domain Filters
29
Filters:-
30
Where D (u, v) –distance from (u,v)
D0 – non- negative quantity
Where:
'D0- specified cut off frequency
31
1. Ideal high pass filter
This filter is opposite of the Ideal Low Pass filter and has the transfer function of the
form
Homomorphic Filtering
Homomorphic filters are widely used in image processing for compensating the
effect of no uniform illumination in an image. Pixel intensities in an image
represent the light reflected from the corresponding points in the objects. As per
as image model, image f(z,y) may be characterized by two components:
(1) The amount of source light incident on the scene being viewed
(2) The amount of light reflected by the objects in the scene.
f ( x , y) = i ( x , y).r(x, y)
Taking the logarithm of the two sides
log f(x,y) = log i(x, y) + log r(x, y).
Taking Fourier transforms on both sides we get,
32
Describe the properties of Fourier Transform
Linearity:
Scaling:
Differentiation:
Convolution:
Frequency Shift
Time Shift:
Example:
33
34
35