Ip Unit-3
Ip Unit-3
Ip Unit-3
COURSE MATERIAL
UNIT III
COURSE B.TECH
SEMESTER 41
VERSION V-5
1 IP-UNIT-III
BTECH_ECE-SEM 41
SVEC TIRUPATI
2 IP-UNIT-III
BTECH_ECE-SEM 41
SVEC TIRUPATI
1. Course Objectives
The objectives of this course is to
To introduce fundamentals of Image Processing.
To expose various intensity transformations in spatial and frequency domains.
To impart concepts of wavelets and various coding techniques for image
compression.
To dissimilate various segmentation techniques for images.
To teach various color models and to introduce the concepts of color image
segmentation.
2. Prerequisites
Students should have knowledge on
1. Preliminary Mathematics
2. Principals of Signals and systems
3. Syllabus
UNIT III
Image Segmentation, Detection of discontinuities, edge linking and boundary
detection, thresholding – global and adaptive, region-based segmentation.
4. Course Outcomes
Analyze various types of images mathematically.
Compare image enhancement methods in spatial and frequency domains.
Demonstrate various segmentation algorithms for given image.
Justify DCT and wavelet transform techniques for image compression.
Describe various color models for color image processing.
5. Co-PO / PSO Mapping
PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 P10 PO11 PO12 PSO1 PSO2
CO1 3 3 2 3 3
CO2 3 3 2 2 3 3 3
CO3 3 3 3 2 2 3 3 3
CO4 3 3 3 3 2 2 3 3 3
CO5 3 3 2 3 3 3
3 IP-UNIT-III
BTECH_ECE-SEM 41
SVEC TIRUPATI
6. Lesson Plan
4 Least Mean Square filters and Constrained Least square restoration T1, R1
4 IP-UNIT-III
BTECH_ECE-SEM 41
SVEC TIRUPATI
8. Lecture Notes
(c)Spectral profiles that provide multidimensional image data Elaborate systems may
use a combination of these properties to segment images, while
BTECH_ECE-SEM 41
SVEC TIRUPATI
Edges are places in the image with strong intensity contrast. Since edges often occur
at image locations representing object boundaries, edge detection is extensively
used in image segmentation when we want to divide the image into areas
corresponding to different objects. Representing an image by its edges has the
further advantage that the amount of data is reduced significantly while retaining
most of the image information.
It is optimal for step edges corrupted by white noise. Optimality related to three
criteria
Detection criterion ... important edges should not be missed, there should be no
spurious responses
localization criterion ... distance between the actual and located position of the
edge should be minimal
o one response criterion ... minimizes multiple responses to a single edge (also partly
covered by the first criterion since when there are two responses to a single edge
one of them should be considered as false)
1) The edge detector was expressed for a 1D signal and the first two optimality
criteria. Aclosed form solution was found using the calculus of variations.
2) If the third criterion (multiple responses) is added, the best solution may be found
by numerical optimization. The resulting filter can be approximated effectively with
error less than 20% by the first derivative of a Gaussian smoothing filter with
standard deviation; the reason for doing this is the existence of an effective
implementation.
6 IP-UNIT-III
BTECH_ECE-SEM 41
SVEC TIRUPATI
The edge location is then at the local maximum in the direction n of the operator Gn
convoluted with the image g
This equation shows how to find local maxima in the direction perpendicular to the
edge; this operation is often referred to as non-maximum suppression.
4) Spurious responses to the single edge caused by noise usually create a so called
'streaking' problem that is very common in edge detection in general.
BTECH_ECE-SEM 41
SVEC TIRUPATI
If any edge response is above a high threshold, those pixels constitute definite
output of the edge detector for a particular scale.
Individual weak responses usually correspond to noise, but if these points are
connected to any of the pixels with strong responses they are more likely to be
actual edges in the image.
Such connected pixels are treated as edge pixels if their response is above a
low threshold.
The low and high thresholds are set according to an estimated signal to noise
ratio.
5) The correct scale for the operator depends on the objects contained in the
image.
• The solution to this unknown is to use multiple scales and aggregate information
from them.
• There may be several scales of operators that give significant responses to edges
(i.e., signal to noise ratio above the threshold); in this case the operator with the
smallest scale is chosen as it gives the best localization of the edge.
All significant edges from the operator with the smallest scale are marked first.
Edges of a hypothetical operator with larger are synthesized from them (i.e., a
prediction is made of how the large should perform on the evidence gleaned
from the smaller).
Then the synthesized edge response is compared with the actual edge
response for larger.
Additional edges are marked only if they have significantly stronger response
than that predicted from synthetic output.
Algorithm:
1. Repeat steps (2) till (6) for ascending values of the standard deviation .
BTECH_ECE-SEM 41
SVEC TIRUPATI
3. Estimate local edge normal directions n for each pixel in the image.
7. Aggregate the final information about edges at multiple scale using the `feature
synthesis approach.
(b)Edge Operators:
Since edges consist of mainly high frequencies, we can, in theory, detect edges by
applying a high pass frequency filter in the Fourier domain or by convolving the
image with an appropriate kernel in the spatial domain. In practice, edged
detection is performed in the spatial domain, because it is computationally less
expensive and often yields better results.
Calculating this formula is equivalent to convolving the function with [-1 1]. Similarly
the 2nd derivative can be estimated by convolving f(i) with [1 -2 1]. Different edge
detection kernels which are based on the above formula enable us to calculate
either the 1st or the 2nd derivative of a two-dimensional image. There are two
common approaches to estimate the 1st derivative in a two-dimensional image,
Prewitt compass edge detection and gradient edge detection.Prewitt compass
edge detection involves convolving the image witha setof(usually 8)kernels, each of
which is sensitive to a different edge orientation. The kernel producing the maximum
response at a pixel location determines the edge magnitude and orientation.
Different sets of kernels might be used: examples include Prewitt, Sobel, Kirsch
and Robinson kernels. Gradient edge detection is the second and more widely
used technique. Here, the image is convolved with only two kernels, one estimating
the gradient in the x-direction, Gx, the other the gradient in the y-direction, Gy. The
absolute gradient magnitude is then given by
9 IP-UNIT-III
BTECH_ECE-SEM 41
SVEC TIRUPATI
An operator based on the 2nd derivative of an image is the Marr edge detector,
also known as zero crossing detector. Here, the 2nd derivative is calculated using a
Laplacian of Gaussian (LoG) filter. The Laplacian has the advantage that it is an
isotropic measure of the 2nd derivative of an image, i.e. the edge magnitude is
obtained independently from the edge orientation by convolving the image with
only one kernel. The edge positions are then given by the zero-crossings in the LoG
image. The scale of the edges which are to be detected can be controlled by
changing the variance of the Gaussian. A general problem for edge detection is its
sensitivity to noise, the reason being that calculating the derivative in the spatial
domain corresponds to accentuating high frequencies and hence magnifying noise.
This problem is addressed in the Canny and Marr operators by convolving the image
with a smoothing operator (Gaussian) before calculating the derivative.
While edges (I. E. boundaries between regions with relatively distinct graylevels) are
by far the most common type of discontinuity in an image, instances of thin lines in
an image occur frequently enough that it is useful to have a separate mechanism
for detecting them. A convolution based technique can be used which produces
an image description of the thin lines in an input image. Note that the Hough
transform can be used to detect lines; however, in that case, the output is a P ARA
10 I P - U N I T - I I I
BTECH_ECE-SEM 41
SVEC TIRUPATI
ME TRIC description of the lines in an image. The line detection operator consists of a
convolution kernel tuned to detect the presence of lines of a particular width n, at a
particular orientation ө. Figure below shows a collection of four such kernels, which
each respond to lines of single pixel width at the particular orientation shown.
Four line detection kernels which respond maximally to horizontal, vertical and
oblique (+45 and - 45 degree) single pixel wide lines. These masks above are tuned
for light lines against a dark background, and would give a big negative
response to dark lines against a light background. If we are only interested in
detecting dark lines against a light background, then we should negate the mask
values. Alternatively, we might be interested in either kind of line, in which case, we
could take the absolute value of the convolution output.
If Ri denotes the response of kernel I, we can apply each of these kernels across an
image, and for any particular point, if for all that point is more likely to contain a line
whose orientation (and width) corresponds to that of kernel I. One usually thresholds
to eliminate weak lines corresponding to edges and other features with intensity
gradients which have a different scale than the desired line width. In order to find
complete lines, one must join together line fragments, ex: with an edge tracking
operator.
3.3. THRESHOLDING
Gray level thresholding is the simplest segmentation process. Many objects or image
regions are characterized by constant reflectivity or light absorption of their surface.
Thresholding is computationally inexpensive and fast. Thresholding can easily be
done in real time using specialized hardware. Complete segmentation can result
from thresholding in simple scenes.
Search all the pixels f(i,j) of the image f. An image element g(i,j) of the segmented
image is an object pixel if f(i,j) >= T, and is a background pixel otherwise.
11 I P - U N I T - I I I
BTECH_ECE-SEM 41
SVEC TIRUPATI
It is successful only under very unusual circumstances. Gray level variations are likely
due to non-uniform lighting, non-uniform input device parameters or a number of
other factors.
T=T(f)
P-type thresholding
choose a threshold T (based on the image histogram) such that 1/p of the image
area has gray values less than T and the rest has gray values larger than T.
in text segmentation, prior information about the ratio between the sheet area
and character area can be used.
BTECH_ECE-SEM 41
SVEC TIRUPATI
bimodal histogram - if objects have approximately the same gray level that differs
from the gray level of the background
• Mode Method: find the highest local maxima first and detect the threshold as a
minimum between them. To avoid detection of two local maxima belonging to the
same global maximum, a minimum distance in gray levels between these maxima is
usually required or techniques to smooth histograms are applied.
•graylevel
•color
•texture
•shape
• model
The basic purpose of region growing is to segment an entire image R into smaller sub-
images, Ri, i=1,2,….,N. which satisfy the following conditions:
13 I P - U N I T - I I I
BTECH_ECE-SEM 41
SVEC TIRUPATI
(b)Region Splitting:
The basic idea of region splitting is to break the image into a set of disjoint regions,
which are coherent within themselves:
• Look at the area of interest and decide if all pixels contained in the region satisfy
some
similarity constraint.
• If TRUE then the area of interest corresponds to an entire region in the image.
• If FALSE split the area of interest (usually into four equal subareas) and consider
each of the sub-areas as the area of interest in turn.
• This process continues until no further splitting occurs. In the worst case this happens
when the areas are just one pixel in size.
If only a splitting schedule is used then the final segmentation would probably
contain many neighboring regions that have identical or similar properties. We need
to merge these regions.
(c)Region merging:
The result of region merging usually depends on the order in which regions are
merged. Thesimplest methods begin merging by starting the segmentation using
regions of 2x2, 4x4 or8x8 pixels. Region descriptions are then based on their statistical
gray level properties. Aregion description is compared with the description of an
adjacent region; if they match, theyare merged into a larger region and a new
region description is computed. Otherwise regions are marked as non-matching.
Merging of adjacent regions continues between all neighbors, including newly
formed ones. If a region cannot be merged with any of its neighbors, it is marked
`final' and the merging process stops when all image regions are so marked. Merging
Heuristics:
• Two adjacent regions are merged if a significant part of their common boundary
consists of weak edges
14 I P - U N I T - I I I
BTECH_ECE-SEM 41
SVEC TIRUPATI
• Two adjacent regions are also merged if a significant part of their common
boundary consists of weak edges, but in this case not considering the total length of
the region borders.
Of the two given heuristics, the first is more general and the second cannot be used
alone because it does not consider the influence of different region sizes.
The last case is called as “Split and Merge” method. Region merging methods
generally use similar criteria of homogeneity as region splitting methods, and only
differ in the direction of their application.
To illustrate the basic principle of split and merge methods, let us consider an
imaginary image.
• Not all the pixels in Fig (a) are similar. So the region is split as in Fig. (b).
• Assume that all pixels within each of the regions I1, I2 and I3 are similar, but those in
I4 are not.
• Now assume that all pixels within each region are similar with respect to that
region, and that after comparing the split regions, regions I43 and I44 are found to
be identical.
15 I P - U N I T - I I I
BTECH_ECE-SEM 41
SVEC TIRUPATI
A combination of splitting and merging may result in a method with the advantages
of both the approaches. Split-and-merge approaches work using pyramid image
representations. Regions are square-shaped and correspond to elements of the
appropriate pyramid level. If any region in any pyramid level is not homogeneous
(excluding the lowest level), it is split into four sub-regions -- these are elements of
higher resolution at the level below. If four regions exist at any pyramid level with
approximately the same value of homogeneity measure, they are merged
into a single region in an upper pyramid level. We can also describe the
splitting of the image using a tree structure, called a modified quad tree. Each non-
terminal node in the tree has at most four descendants, although it may have less
due to merging. Quad tree decomposition is an operation that subdivides an image
into blocks that contain "similar" pixels. Usually the blocks are square, although
sometimes they may be rectangular. For the purpose of this demo, pixels in a block
are said to be "similar" if the range of pixel values in the block are not greater
than some threshold. Quad tree decomposition is used in variety of image analysis
and compression applications. An unpleasant drawback of segmentation quad
trees, is the square region shape assumption. It is not possible to merge regions which
are not part of the same branch of the segmentation tree. Because both split-and-
merge processing options are available, the starting segmentation
does not have to satisfy any of the homogeneity conditions. The segmentation
process can be understood as the construction of a segmentation quad tree where
each leaf node represents a homogeneous region. Splitting and merging
corresponds to removing or building parts of the segmentation quad tree.
16 I P - U N I T - I I I
BTECH_ECE-SEM 41
SVEC TIRUPATI
(e)Region growing:
Region growing approach is the opposite of the split and merges approach:
• Start by choosing an arbitrary seed pixel and compare it with neighboring pixels
• Region is grown from the seed pixel by adding in neighboring pixels that are similar,
increasing the size of the region.
• When the growth of one region stops we simply choose another seed pixel which
does not yet belong to any region and start again.
• This whole process is continued until all pixels belong to some region.
• A bottom up method.
Region growing methods often give very good segmentations that correspond well
to the observed edges.
However starting with a particular seed pixel and letting this region grow completely
before trying other seeds biases the segmentation in favour of the regions which are
segmented first. This can have several undesirable effects:
• Problems can occur if the (arbitrarily chosen) seed point lies on an edge.
17 I P - U N I T - I I I
BTECH_ECE-SEM 41
SVEC TIRUPATI
To counter the above problems, simultaneous region growing techniques have been
developed.
• Similarities of neighboring regions are taken into account in the growing process.
• Control of these methods may be quite complicated but efficient methods have
been developed.
9. Practice Quiz
1. Gaussian noise is referred to as
a)red noise b)black noise c)white noise d)normal noise
2. Filter that replaces the pixel value with the medians of intensity levels is
a)arithmetic mean filter b)geometric mean filter
c)median filter d)sequence mean filter
3. In geometric mean filters when alpha is equal to 1 then it works as
a)notch filter b)band pass filter
c)wiener filter d)inverse filter
4. In wiener filtering it is assumed that noise and image are
a)different b)homogenous c)correlated d)uncorrelated
5. The purpose of restoration is to gain
a)degraded image b)original image c)pixels d)coordinates
6. Restoration cannot be done using
a)single projection b)double projection c)triple projection d)octa projection
7. Mean filters reduce noise using
a)sharpening b)blurring c)restoration d)acquisition
8. In geometric mean filters when alpha is equal to 0 then it works as
a)notch filter b)bandpass filter c)parametric wiener filter d)inverse filter
9. To improve the speed of convergence algorithm used is
a)newton b)Raphson c)wiener d)newton-Raphson
10.Degraded image is produced using degradation process and
a)additive noise b)destruction c)pixels d)coordinates
18 I P - U N I T - I I I
BTECH_ECE-SEM 41
SVEC TIRUPATI
10 Assignments
S.No Question BL CO
1 Explain about Region based Segmentation 2 1
2 Explain concept of global level thresolding 1 1
3 Explain about canny edge detection 2 1
4 Explain concept of line detection 2 1
S.No Question BL CO
With necessary expressions, explain the Wiener filtering
1 3 1
approach for image restoration. (Adv. Supp 2018)
19 I P - U N I T - I I I
BTECH_ECE-SEM 41
SVEC TIRUPATI
References:
1. S jayaraman, S Esakkirajan, T Veerakumar, “Digital Image processing”,Tata
McGraw Hill
2. William K. Pratt, “Digital Image Processing”, John Wilely, 3rd Edition, 2004
20 I P - U N I T - I I I
BTECH_ECE-SEM 41
SVEC TIRUPATI
21 I P - U N I T - I I I
BTECH_ECE-SEM 41