Professional Documents
Culture Documents
Image Segmentation:
Thresholding
The Segmentation Problem
•Segmentation attempts to partition the
pixels of an image into groups that strongly
correlate with the objects in an image
•Typically the first step in any automated
computer vision application
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Segmentation Examples
Detection Of Discontinuities
•There are three basic types of grey level
discontinuities that we tend to look for in
digital images:
– Points
– Lines
– Edges
•We typically find discontinuities using
masks and correlation
Point Detection
Point detection can be achieved simply
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
detect lines
•The masks below will extract lines that are
one pixel thick and running in a particular
direction
Line Detection (cont…)
Binary image of a wire
bond mask
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
After
Result of
processing
thresholding
with -45° line
filtering result
detector
Edge Detection
•An edge is a set of connected pixels that lie
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
histogram spaces
color space
texture space
I = imread('pout.tif');
figure, imshow(I);
figure, imhist(I) %look at the hist to get a threshold, e.g., 110
BW=roicolor(I, 110, 255); % makes a binary image
figure, imshow(BW) % all pixels in (110, 255) will be 1 and white
% the rest is 0 which is black
• A method based on
Discrete Curve Evolution
to find thresholds in the histogram.
v v
> w
w u
u
Gray Scale Image - Multimodal
Histogram of lena
Segmented Image
Image after segmentation – we get a outline of her face, hat, shadow etc
Color Image - bimodal
X = i=1,..N U R(i)
R(i) ∩ R(j) = 0 for I ≠ j
P(R(i)) = TRUE for i = 1,2,…,N
P(R(i) U R(j)) = FALSE for i ≠ j
Introduction
• The segmentation property is a logical
predicate of the form P(R,x,t)
• x is a feature vector associated with region
R
• t is a set of parameters (usually
thresholds). A simple segmentation rule
has the form:
P(R) : I(r,c) < T for all (r,c) in R
Introduction
• In the case of color images the feature
vector x can be three RGB image
components (R(r,c),G(r,c),B(r,c))
• A simple segmentation rule may have the
form:
P(R) : (R(r,c) <T(R)) && (G(r,c)<T(G))&&
(B(r,c) < T(B))
Region Growing (Merge)
• A simple approach to image segmentation
is to start from some pixels (seeds)
representing distinct image regions and to
grow them, until they cover the entire
image
• For region growing we need a rule
describing a growth mechanism and a rule
checking the homogeneity of the regions
after each growth step
Region Growing
• The growth mechanism – at each stage k
and for each region Ri(k), i = 1,…,N, we
check if there are unclassified pixels in the
8-neighbourhood of each pixel of the
region border
• Before assigning such a pixel x to a region
Ri(k),we check if the region homogeneity:
P(Ri(k) U {x}) = TRUE , is valid
Region Growing Predicate
The arithmetic mean m and standard deviation std of a
region R having n =|R| pixels:
1 1
m( R ) I ( r , c ) std ( R) ( I ( r , c ) m ( R )) 2
n ( r ,c )R n 1 ( r ,c )R
The predicate
P: |m(R1) – m(R2)| < k*min{std(R1), std(R2)},
is used to decide if the merging
of the two regions R1, R2 is allowed, i.e.,
if |m(R1) – m(R2)| < k*min{std(R1), std(R2)},
two regions R1, R2 are merged.
Split
• The opposite approach to region growing is
region splitting.
• It is a top-down approach and it starts with the
assumption that the entire image is
homogeneous
• If this is not true, the image is split into four sub
images
• This splitting procedure is repeated recursively
until we split the image into homogeneous
regions
Split
• If the original image is square N x N, having
dimensions that are powers of 2(N = 2n):
• All regions produced but the splitting algorithm
are squares having dimensions M x M , where
M is a power of 2 as well.
• Since the procedure is recursive, it produces an
image representation that can be described by a
tree whose nodes have four sons each
• Such a tree is called a Quadtree.
Split
Quadtree
R0 R1
R0
R3
R2 R1