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

unit-4-dip

Unit 4 notes of digital image processing.

Uploaded by

sahilrz78600
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views

unit-4-dip

Unit 4 notes of digital image processing.

Uploaded by

sahilrz78600
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 115

Unit 4

Image Segmentation-Fundamentals
• where Q (Rk ) is a logical predicate defined over the points in set Rk , and
is the null set.

• Two regions Ri and Rj are said to be adjacent if their union forms a


connected set.
• If the set formed by the union of two regions is not connected, the regions
are said to disjoint.
• Condition (a) indicates that the segmentation must be complete, in
the sense that every pixel must be in a region.
• Condition (b) requires that points in a region be connected in some
predefined sense (e.g., the points must be 8-connected).
• Condition (c) says that the regions must be disjoint.
• Condition (d) deals with the properties that must be satisfied by the
pixels in a segmented region—for example, Q Ri ( )= TRUE if all pixels
in Ri have the same intensity.
• Finally, condition (e) indicates that two adjacent regions Ri and Rj
must be different in the sense of predicate Q.
• The fundamental problem in segmentation is to partition an image
into regions that satisfy the preceding conditions.
• Segmentation algorithms for monochrome images generally are
based on one of two basic categories dealing with properties of
intensity values:
• discontinuity
• similarity.
Discontinuity
• we assume that boundaries of regions are sufficiently different from each
other, and from the background, to allow boundary detection based on
local discontinuities in intensity.
• Edge-based segmentation is the principal approach used in this category.
Similarity
• Region-based segmentation approaches in the similarity category are
based on partitioning
• an image into regions that are similar according to a set of predefined
criteria.
• The numerous spurious changes in intensity make it difficult to identify a
unique boundary for the original image because many of the nonzero
intensity changes are connected to the boundary, so edge-based
segmentation is not a suitable approach.
• However, we note that the outer region is constant, so all we need to solve
this segmentation problem is a predicate that differentiates between
textured and constant regions.
• The standard deviation of pixel values is a measure that accomplishes this
because it is nonzero in areas of the texture region, and zero otherwise.
• Figure 10.1(f) shows the result of dividing the original image into
subregions of size 8 × 8.
• Each subregion was then labeled white if the standard deviation of its
pixels was positive (i.e., if the predicate was TRUE), and zero otherwise.
Edge detection
• Edge detection is an approach used frequently for segmenting images
based on abrupt (local) changes in intensity.
• Edge pixels are pixels at which the intensity of an image changes
abruptly.
• Edges (or edge segments) are sets of connected edge pixels
• Edge models are classified according to their intensity profiles
• step edge
• ramp edge
• roof edge
Step edge
• A step edge is characterized by a transition between two intensity
levels occurring ideally over the distance of one pixel.
• (images generated by a computer)
• Canny edge detection algorithm
ramp edge
• In practice, digital images have edges that are blurred and noisy, with
the degree of blurring determined principally by limitations in the
focusing mechanism (e.g., lenses in the case of optical images), and
the noise level determined principally by the electronic components
of the imaging system.
• In such situations, edges are more closely modeled as having an
intensity ramp profile.
• The slope of the ramp is inversely proportional to the degree to which
the edge is blurred.
• In this model, we no longer have a single “edge point” along the
profile.
• Instead, an edge point now is any point contained in the ramp, and an
edge segment would then be a set of such points that are connected.
roof edge
• Roof edges are models of lines through a region, with the base
(width) of the edge being determined by the thickness and sharpness
of the line.
• In the limit, when its base is one pixel wide, a roof edge is nothing
more than a one-pixel-thick line running through a region in an
image.
• Roof edges arise, for example, in range imaging, when thin objects
(such as pipes) are closer to the sensor than the background (such as
walls). The pipes appear brighter.
• Other areas in which roof edges appear routinely are in the
digitization of line drawings and also in satellite images, where thin
features, such as roads, can be modeled by this type of edge.
► Edge point detection
• Magnitude of the first derivative.
• Sign change of the second derivative.
► Observations:
• Second derivative produces two values for an edge.
• Its zero crossings may be used to locate the centres of thick edges.
Fundamental steps in edge detection
►Image smoothing for noise reduction.
–Derivatives are very sensitive to noise.
►Detection of candidate edge points.
►Edge localization.
–Selection of the points that are true members of the set of points comprising
the edge.
Basic Edge Detection by Using First-Order
Derivative  f 
 g x   x 
• The tool of choice for finding edge f  grad ( f )      
strength and direction at an  g y   f 
 y 
arbitrary location (x, y) of an image,
f, is the gradient, The magnitude of f
M ( x, y )  mag(f )  g x 2  g y 2
The direction of f
 gx 
 ( x, y )  tan  
1

 g y 
The direction of the edge
   - 90
The gradient vector sometimes is
called the edge normal
 f 
 gx   x 
Edge normal: f  grad ( f )      
 g y   f 
When the vector is normalized to unit
length by dividing it by its magnitude, the resulting  y 
vector is referred to as the edge unit normal.

Edge unit normal: f / mag(f )


In practice,sometimes the magnitude is approximated by
f f  f f 
mag(f )= + or mag(f )=max  | |,| | 
x y  x y 
Gradient Operators
Obtaining the gradient of an image requires computing the partial derivatives df /dx and df/ dy at every
pixel location in the image.
For the gradient, we typically use a forward or centered finite difference

• forward differences
• Roberts cross-gradient operators :
The Roberts operators are based on implementing the diagonal
differences
Kernels of size 2 × 2 are simple conceptually, but they are not as useful
for computing edge direction as kernels that are symmetric about their
centers, the smallest
of which are of size 3 × 3.

In this formulation, the difference between the third and first rows of the 3X3 region approximates the
derivative in the x-direction, and the difference between the third and first columns approximate the
derivative in the y-direction.

Intuitively, we would expect these approximations to be more accurate than the approximations
obtained using the Roberts operators.
Sobel operators
• A slight variation of the Prewitt two equations uses a weight of 2 in
the center coefficient:

The Prewitt kernels are simpler to implement than the Sobel kernels, but the slight computational
difference between them typically is not an issue.
The fact that the Sobel kernels have better noise-suppression (smoothing) characteristics makes them
preferable because, noise suppression is an important issue when dealing with derivatives
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by CamScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned by TapScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Scanned with CamScanner
Text Book:
Rafael C. Gonzalez, Richard E. Woods, Digital Image Processing Pearson,
Third/Fourth Edition. (Chapter 10)
Based on visualizing an image in 3D

imshow(I,[ ]) mesh(I)
Instead of working on an
image itself, this technique
is often applied on its
gradient image.
In this case, each object is
distinguished from the
background by its up-lifted
edges
I: 2D gray level image
DI: Domain of I
Path P of length between p and q in I
A ( +1)-tuple of pixels (p0=p,p1 p =q) such that
pi,pi+1 are adjacent (4 adjacent, 8 adjacent, or m
adjacent)
(P): The length of a given path P
Minimum
A minimum M of I is a connected plateau of pixels
from which it is impossible to reach a point of lower
altitude without having to climb
Instead of working on an image itself, this technique is often applied
on its gradient image.
Three types of points
Points belonging to a regional minimum
Catchment basin / watershed of a regional minimum
Points at which a drop of water will certainly fall to a single minimum
Divide lines / Watershed lines
Points at which a drop of water will be equally likely to fall to more than one
minimum
Crest lines on the topographic surface
This technique is to identify all the third type of points for
segmentation
1. Piercing holes in
each regional
minimum of I
2. The 3D topography
is flooded from
below gradually
3. When the rising
water in distinct
catchment basins is
about to merge, a
dam is built to
prevent the merging
3. The dam
boundaries
correspond to
the watershed
lines to be
extracted by a
watershed
segmentation
algorithm
- Eventually only
constructed
dams can be
seen from
above
Based on binary morphological dilation
At each step of the algorithm, the binary
image in obtained in the following
manner
1. Initially, the set of pixels with minimum gray
level are 1, others 0.
2. In each subsequent step, we flood the 3D
topography from below and the pixels
covered by the rising water are 1s and
others 0s. (See previous slides)
M1, M2:
Sets of coordinates of points
in the two regional minima
Cn-1(M1), Cn-1(M2)
Sets of coordinates of points
in the catchment basins
associated with M1 M2 at
stage n-1 of flooding
(catchment basins up to the
flooding level)
C[n-1]
Union of Cn-1(M1), Cn-1(M2)
At flooding step n-1, there are
two connected components. At
flooding step n, there is only
one connected component
This indicates that the water
between the two catchment basins
has merged at flooding step n

connected component
Steps
Repeatedly dilate Cn-1(M1), Cn-1(M2)
by the 3 3 structuring element
shown, subject to the following
condition
Constrained to q (center of the
structuring element can not go
beyond q during dilation
The dam is constructed by
the points on which the
dilation would cause the
sets being dilated to merge.
Resulting one-pixel thick
connected path
Setting the gray level at
each point in the resultant
path to a value greater than
the maximum gray value of
the image. Usually max+1
Denote M1, M2 R as the sets of
the coordinates of the points in the
regional minima of an (gradient) image n-1
g(x,y)
Denote C(Mi) as the coordinates of the Mi
points in the catchment basin C(Mi)
associated with regional minimum Mi. T(n)
Denote the minimum and maximum
gray levels of g(x,y) as min and max
Denote T[n] as the set of coordinates
(s,t) for which g(s,t) < n
Flood the topography in integer flood
increments from n=min+1 to n=max+1
At each flooding, the topography is
viewed as a binary image
Denote Cn(Mi) as the set of
coordinates of points in the catchment n-1
basin associated with minimum Mi at
flooding stage n.
Mi
Cn(Mi)= C(Mi) T[n]
C(Mi)
Cn(Mi)= T[n]
T(n)
Denote C[n] as the union of the Cn(Mi)
flooded catchment basin portions at
stage n:
C(n)

Initialization
Let C[min+1]=T[min+1]
At each step n, assume C[n-1] has
been constructed. The goal is to
obtain C[n] from C[n-1]
Dam
Denote Q[n] as the set of connected n-1
components in T[n].
For each q Q[n], there are three n-2
possibilities
1. q C[n-1] is empty (q1)
Mi
A new minimum is encountered C(Mi)
q is incorporated into C[n-1] to form C[n] T(n-1)
2. q C[n-1] contains one connected Cn-1(Mi)
component of C[n-1] (q2)
q is incorporated into C[n-1] to form C[n]
3. q C[n-1] contains more than one C(n-1)
connected components of C[n-1] (q3) T(n)
A ridge separating two or more catchment q3 q1 q2
basins has been encountered
A dam has to be built within q to prevent
overflow between the catchment basins
4. Repeat the procedure until n=max+1 C(n)
Watershed Transform of Binary Image
A: Original image B: Negative of image A
C: Distance transform of B D: Watershed transform of C A B
C D
Distance transform of a binary image is
defined by the distance from every pixel to
the nearest non-zero valued pixel
a: Original image
b: Gradient image of image a
c: Watershed lines obtained
from image b
(oversegmentation)
Each connected region
contains one local
minimum in the
corresponding gradient
image
d: Watershed lines obtained
from smoothed image b
a b
c d
Internal markers are used to limit the
number of regions by specifying the
objects of interest
Like seeds in region growing method
Can be assigned manually or automatically
Regions without markers are allowed to be
merged (no dam is to be built)
External markers those pixels we are
confident to belong to the background
Watershed lines are typical external markers
and they belong the same (background)
region
1. Use internal markers to obtain watershed lines of the
gradient of the image to be segmented.
2. Use the obtained watershed lines as external markers
3. Each region defined by the external markers contains a
single internal marker and part of the background
4. The problem is reduced to partitioning each region into
two parts: object (containing internal markers) and a single
background (containing external markers)
Global thresholding, region growing, region splitting and
merging, or watershed transform
A: Original image f
B: Direct watershed transform
result using the following
commands
L=watershed(g)
wr = L ==0
g is the gradient image of A
C: shows all of the regional
minima of g using

D: internal markers obtained by


im = imextendedmin(g,2)
fim = f;
fim(im) = 175;
E: External markers using
Lim = watershed(bwdist(im))
em = Lim ==0
F: Modified gradient image
obtained from internal and
external markers AB C
g2 = imimposemin(g, im | em)
G: Final segmentation result DEF
L2 = watershed(g2)
f2 = f; G
f2(L2 == 0) = 255

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy