Week 10 - Image Segmentation (Part 2) (1)
Week 10 - Image Segmentation (Part 2) (1)
Otsu's Method
Otsu’s thresholding technique is a classification-based method which searches for the
threshold that minimizes the intra-class variance, defined as a weighted sum of
variances of the two classes.
It is the most popular method of binarizing a grayscale image. Otsu’s algorithms simply
assume that a grayscale image consists of two types of pixels. Foreground and
background pixels.
It divides all the pixels into two clusters. It minimises the intra-cluster variation (within
class variance) by maximising the inter-cluster variance (between class variance).
Finally, it returns a single intensity value which is called a threshold value. This
threshold value divides the two clusters of pixels.
All pixels of one cluster are assigned intensity value 0 and pixels of the second cluster
are assigned value 1. Thus, it binarises the grayscale image.
1. Otsu's Method
I = imread('house.jpg');
T = graythresh(I);
BW = im2bw(I, T);
imshow(I);
figure; imshow(BW)
I = imread('coins.bmp');
T = graythresh(I);
BW = im2bw(I, T);
imshow(I);
figure; imshow(BW)
•
% Read image
I = imread('circle.jpg');
% Show imageimshow(I);
% Calculate two threshold values
thresh = multithresh(I, 2);
%Image segmentation into three levels with imquantize
function
seg_I = imquantize(I,thresh);
% Convert segmented images to color images by using the
label2rgb function and display
RGB = label2rgb(seg_I);
figure;imshow(RGB)
axis off
title('RGB Segmented Image')
2. Region Growing
Region growing is a pixel-based image segmentation
method that starts with a set of "seed" points and grows
regions by appending neighboring pixels that satisfy
predefined similarity criteria.
Core Concept
The fundamental idea of region growing is to start with one
or more seed points and incrementally add similar
neighboring pixels to form coherent regions. The process
continues until no more pixels can be added to any region.
Algorithm Steps
1.Seed Selection: Choose one or more initial seed pixels.
These can be selected manually, randomly, or based on
certain criteria.
2.Region Expansion:
o Examine the neighboring pixels of each seed.
o Add neighboring pixels to the region if they satisfy
similarity criteria.
o Each added pixel becomes a new seed for further
expansion.
3.Stopping Criteria: Continue until no more pixels can be
added to any region based on the similarity criteria.
Similarity Criteria
Common similarity measures include:
•Pixel intensity difference (less than a threshold)
•Statistical properties like mean and standard
deviation
•Texture features
•Color similarity in multi-channel images
2. Region Growing
• Usually statistical tests are used to decide whether
or not a pixel can be joined into a region.
• Advantages: having good connectivity between
pixels within the region
• Disadvantages:
- the right selection of seed
- criteria for quitting
- consuming a long time
Unseeded Region Growing
• Region growing method without feed specification
• Using a fast scanning algorithm