SlideShare a Scribd company logo
1 of 60
Image Segmentation
Elsayed Hemayed
Overview
• Segmentation
• Thresholding Segmentation Techniques
• Segmentation as clustering
• Mean shift segmentation
2Image Segmentation
Image Segmentation
• Goal: identify groups of pixels that go
together
3Image Segmentation
The Goals of Segmentation
• Separate image into coherent “objects”
4
The Goals of Segmentation
• Separate image into coherent “objects”
• Group together similar‐looking pixels for
efficiency of further processing
5Image Segmentation
Segmentation
• Goal: to divide an image into parts that have a
strong correlation with objects or areas of the
real world, mainly objects and background.
• A complete segmentation of an image R is a
set of regions R1, R2, …, Rs
iR
S
i
R
1
  ji RR  ji 
6Image Segmentation
Thresholding Segmentation
Technique
• Basic, Band, Multi, Semi-Thresholding
• Threshold detection methods
• Algorithms
– Iterative (optimal) Threshold Selection
– Otsu Segmentation Algorithm
– Recursive multi-spectral thresholding
Advantages
• simplest segmentation process since
Many objects or image regions are
characterized by constant reflectivity or
light absorption of their surface.
• computationally inexpensive and fast and
can easily be done in real time
8Image Segmentation
Basic Thresholding
• Basic thresholding of an input image f to an output
image g is as follows:
g(i,j) = 1 for f(i,j)
g(i,j) = 0 for f(i,j)
T
T
9Image Segmentation
Band Thresholding
• There are several modifications on basic thresholding.
They include:
1. Band thresholding:
g(i,j) = 1 for f(i,j) f(i,j)
g(i,j) = 0 otherwise
• used e.g. in microscopic blood cells
D
10Image Segmentation
Multi-Thresholding
2. Multi-thresholding, using limited set of array levels:
g(i,j) = 1 for f(i,j)
g(i,j) = 2 for f(i,j)
g(i,j) = 3 for f(i,j)
.
.
.
g(i,j) = n for f(i,j)
g(i,j) = 0 otherwise
1
D
2
D
3
D
nD
11Image Segmentation
Semi-Thresholding
3. Semi-thresholding, masks out background
g(i,j) = f(i,j) for f(i,j)
g(i,j) = 0 for f(i,j)
T
T
12Image Segmentation
Threshold Detection techniques
• If some property of an image after segmentation is
known a priori, the task of threshold selection is
simplified, since the threshold is chosen to ensure this
property is satisfied.
• A main detection technique is based on Histogram
shape analysis:
– The chosen threshold is chosen to meet minimum segmentation
error, by selecting it as the gray level that has minimum
histogram value between the two maxima, that represent objects
and background in the image.
13Image Segmentation
Histogram shape analysis
Distribution of
Background
Distribution of
Objects
Threshold Value
14Image Segmentation
Thresholding Examples
15Image Segmentation
Segmentation Example 1
16Image Segmentation
Segmentation Example 2
17Image Segmentation
Histogram shape analysis (cont.)
Distribution of
Background
Distribution of
Objects
Threshold Value ?
18Image Segmentation
Histogram shape analysis
• P-tile thresholding
 Weighted histograms
 Optimal thresholding
19Image Segmentation
P-tile thresholding
Threshold is selected such that p% of image
pixels has gray values less than T.
A good example is processing text pages.
20Image Segmentation
One option is to weight histogram contribution:
– Excluding pixels with high gradient values that
represent edges will result in histogram with
deeper valley and threshold will be easier to
detect.
– Building histogram for pixels with high
gradient value only, the threshold value would
be the peak of this histogram.
Weighted histograms
21Image Segmentation
Optimal thresholding
It approximates histogram using two or
more probabilities with normal
distribution. The threshold is then the min
probability between the maxima of the
these normal distributions.
It results in minimum error segmentation.
22Image Segmentation
Optimal thresholding
23Image Segmentation
Threshold Detection techniques
Actual Example
24
Brain MR Image Segmentation
25
Apple Grading
Results of segmentation by isodata thresholding. Fruits displayed are defected by scald (top-
left), rot (top-right), frost damage (mid-left), bruise (mid-right), hail damage perfusion
(bottom-left) and flesh damage (bottom-right). For each fruit its original RGB image, its
manual segmentation (ground truth) and its segmentation results are displayed in a row.
Defected areas are displayed in white in ground truth images, whereas segmentations show
defected regions in gray color and healthy ones in white.
Courtesy of D. UNAY, B. GOSSELIN, 2005, "Thresholding-based Segmentation and Apple Grading by Machine Vision", Proc. of
EUSIPCO 2005, Antalya, Turkey. 26
Algorithm: Iterative (optimal)
Threshold Selection
1. As first iteration consider that the 4 corners
contain background pixels only and the
remainder contains object pixels.
2. Calculate and as the average
intensity of background and object pixels.
3. At step t+1 segmentation is performed using
the threshold
t
B t
O
27Image Segmentation
Iterative (optimal) Threshold
Selection (cont.)
4. Re-calculate and according to new segmentation
using:
5. Re-calculate
6. Stop if
t
B t
O
)()1( tt
TT 
28Image Segmentation
Otsu’s Image Segmentation
Algorithm
• Find the threshold that minimizes the weighted
within-class variance.
• Equivalent to maximizing the between-class
variance.
• Operates directly on the gray level histogram
[e.g. 256 numbers, P(i)]
• It is fast (once the histogram is computed).
Otsu: Assumptions
• Histogram (and the image) are bimodal.
• No use of spatial coherence, nor any other notion of
object structure.
• Assumes stationary statistics, but can be modified to
be locally adaptive
• Assumes uniform illumination (implicitly), so the
bimodal brightness behavior arises from object
appearance differences only.
The weighted within-class variance is:
w
2
(t)  q1(t)1
2
(t)  q2 (t)2
2
(t)
Where the class probabilities are estimated as:
q1(t)  P(i)
i1
t
 

L
ti
iPtq
1
2 )()(
𝜇1(𝑡) =
1
𝑞1(𝑡)
𝑖=1
𝑡
𝑖𝑃(𝑖) 𝜇2(𝑡) =
1
𝑞2(𝑡)
𝑖=𝑡+1
𝐿
𝑖𝑃(𝑖)
And the class means are given by:
Otsu’s method: Formulation
Finally, the individual class variances are:
1
2
(t)  [i  1(t)]2 P(i)
q1(t)i1
t



L
ti tq
iP
tit
1 2
2
2
2
2
)(
)(
)]([)( 
Run through the full range of t values and pick the value that minimizes w
2
(t)
Otsu’s method: Formulation
w
2
(t)  q1(t)1
2
(t)  q2 (t)2
2
(t)
Example
Input image Histogram
Global
thresholding
Otsu’s
method
Example (in presence of noise)
Input image Histogram Global threshold
Smoothened image Histogram Otsu’s method
Image partitioning
Input image Histogram Global threshold
Global Otsu’s Method Image partitioning Local Otsu’s method
Thresholding (non-uniform
background)
Input image Global thresholding
using Otsu’s method
Local thresholding
with moving average
1. Initiallize the whole image as a single region.
2. Compute a smoothed histogram for each
spectral band.
3. Find the most significant peak in each
histogram and determine two thresholds on
either sides of the peak.
4. Segment each region in each spectral band into
sub-regions according to these thresholds.
Algorithm: Recursive multi-
spectral thresholding
40Image Segmentation
Recursive multi-spectral
thresholding (cont.):
41Image Segmentation
5. Project each segmentation into a multi-
spectral segmentation.
6. Regions for the next processing steps are
those in the multi-spectral image.
7. Repeat 2-6 until each histogram contains
only one significat peak.
Recursive multi-spectral
thresholding (cont.):
42Image Segmentation
Demo: Multi-spectral thresholding
43Image Segmentation
Thresholding Based Segmentation
Summary
• Basic, Band, Multi, Semi-Thresholding
• Threshold detection methods
• Multi-spectral thresholding
• Algorithms
– Iterative (optimal) Threshold Selection
– Recursive multi-spectral thresholding
44Image Segmentation
Segmentation as clustering
45Image Segmentation
Segmentation as clustering
Encoding both similarity and proximity
46
Image Intensity-based clusters Color-based clusters
K-Means clustering
• K-means clustering based on intensity or color is
essentially vector quantization of the image attributes
– Clusters don’t have to be spatially coherent
47
K-Means pros and cons
• Pros
– Simple and fast
– Converges to a local
minimum of the error function
• Cons
– Need to pick K
– Sensitive to initialization
– Sensitive to outliers
– Only finds “spherical”
clusters
48Image Segmentation
http://www.caip.rutgers.edu/~comanici/MSPAMI/msPamiResults.html
Mean shift segmentation
• An advanced and versatile technique for clustering-based
segmentation
D. Comaniciu and P. Meer, Mean Shift: A Robust Approach toward Feature
Space Analysis, PAMI 2002.
49
• The mean shift algorithm seeks a mode or local
maximum of density of a given distribution
– Choose a search window (width and location)
– Compute the mean of the data in the search window
– Center the search window at the new mean location
– Repeat until convergence
Mean shift algorithm
50Image Segmentation
Region of
interest
Center of
mass
Mean Shift
vector
Mean shift
51Image Segmentation
Region of
interest
Center of
mass
Mean Shift
vector
Mean shift
52Image Segmentation
Region of
interest
Center of
mass
Mean Shift
vector
Mean shift
53Image Segmentation
Region of
interest
Center of
mass
Mean Shift
vector
Mean shift
54Image Segmentation
Region of
interest
Center of
mass
Mean Shift
vector
Mean shift
55Image Segmentation
Region of
interest
Center of
mass
Mean Shift
vector
Mean shift
56Image Segmentation
Region of
interest
Center of
mass
Mean shift
57Image Segmentation
• Cluster: all data points in the attraction basin of a mode
• Attraction basin: the region for which all trajectories lead
to the same mode
Mean shift clustering
58Image Segmentation
• Find features (color, gradients, texture, etc)
• Initialize windows at individual pixel locations
• Perform mean shift for each window until convergence
• Merge windows that end up near the same “peak” or mode
Mean shift Clustering/segmentation
59Image Segmentation
http://www.caip.rutgers.edu/~comanici/MSPAMI/msPamiResults.html
Mean shift segmentation results
60
More results
61Image Segmentation
More results
62Image Segmentation
Mean shift pros and cons
• Pros
– Does not assume spherical clusters
– Just a single parameter (window size)
– Finds variable number of modes
– Robust to outliers
• Cons
– Output depends on window size
– Computationally expensive
– Does not scale well with dimension of feature space
63Image Segmentation

More Related Content

What's hot

AUTOMATIC THRESHOLDING TECHNIQUES FOR OPTICAL IMAGES
AUTOMATIC THRESHOLDING TECHNIQUES FOR OPTICAL IMAGESAUTOMATIC THRESHOLDING TECHNIQUES FOR OPTICAL IMAGES
AUTOMATIC THRESHOLDING TECHNIQUES FOR OPTICAL IMAGESsipij
 
Image Segmentation using Otsu's Method - Computer Graphics (UCS505) Project R...
Image Segmentation using Otsu's Method - Computer Graphics (UCS505) Project R...Image Segmentation using Otsu's Method - Computer Graphics (UCS505) Project R...
Image Segmentation using Otsu's Method - Computer Graphics (UCS505) Project R...Akshit Arora
 
Image segmentation
Image segmentationImage segmentation
Image segmentationDeepak Kumar
 
Edge Detection and Segmentation
Edge Detection and SegmentationEdge Detection and Segmentation
Edge Detection and SegmentationA B Shinde
 
Image segmentation in Digital Image Processing
Image segmentation in Digital Image ProcessingImage segmentation in Digital Image Processing
Image segmentation in Digital Image ProcessingDHIVYADEVAKI
 
Comparative study on image segmentation techniques
Comparative study on image segmentation techniquesComparative study on image segmentation techniques
Comparative study on image segmentation techniquesgmidhubala
 
Comparison of image segmentation
Comparison of image segmentationComparison of image segmentation
Comparison of image segmentationHaitham Ahmed
 
Image segmentation 2
Image segmentation 2 Image segmentation 2
Image segmentation 2 Rumah Belajar
 
Image segmentation ajal
Image segmentation ajalImage segmentation ajal
Image segmentation ajalAJAL A J
 
Video Segmentation
Video SegmentationVideo Segmentation
Video SegmentationSmriti Jain
 
Features image processing and Extaction
Features image processing and ExtactionFeatures image processing and Extaction
Features image processing and ExtactionAli A Jalil
 
various methods for image segmentation
various methods for image segmentationvarious methods for image segmentation
various methods for image segmentationRaveesh Methi
 

What's hot (20)

PPT s08-machine vision-s2
PPT s08-machine vision-s2PPT s08-machine vision-s2
PPT s08-machine vision-s2
 
AUTOMATIC THRESHOLDING TECHNIQUES FOR OPTICAL IMAGES
AUTOMATIC THRESHOLDING TECHNIQUES FOR OPTICAL IMAGESAUTOMATIC THRESHOLDING TECHNIQUES FOR OPTICAL IMAGES
AUTOMATIC THRESHOLDING TECHNIQUES FOR OPTICAL IMAGES
 
Image segmentation
Image segmentationImage segmentation
Image segmentation
 
Image Segmentation using Otsu's Method - Computer Graphics (UCS505) Project R...
Image Segmentation using Otsu's Method - Computer Graphics (UCS505) Project R...Image Segmentation using Otsu's Method - Computer Graphics (UCS505) Project R...
Image Segmentation using Otsu's Method - Computer Graphics (UCS505) Project R...
 
PPT s10-machine vision-s2
PPT s10-machine vision-s2PPT s10-machine vision-s2
PPT s10-machine vision-s2
 
Image segmentation
Image segmentationImage segmentation
Image segmentation
 
Edge Detection and Segmentation
Edge Detection and SegmentationEdge Detection and Segmentation
Edge Detection and Segmentation
 
ijecct
ijecctijecct
ijecct
 
Image segmentation in Digital Image Processing
Image segmentation in Digital Image ProcessingImage segmentation in Digital Image Processing
Image segmentation in Digital Image Processing
 
Comparative study on image segmentation techniques
Comparative study on image segmentation techniquesComparative study on image segmentation techniques
Comparative study on image segmentation techniques
 
Comparison of image segmentation
Comparison of image segmentationComparison of image segmentation
Comparison of image segmentation
 
Image segmentation
Image segmentationImage segmentation
Image segmentation
 
Image segmentation
Image segmentation Image segmentation
Image segmentation
 
Segmentation Techniques -I
Segmentation Techniques -ISegmentation Techniques -I
Segmentation Techniques -I
 
PPT s03-machine vision-s2
PPT s03-machine vision-s2PPT s03-machine vision-s2
PPT s03-machine vision-s2
 
Image segmentation 2
Image segmentation 2 Image segmentation 2
Image segmentation 2
 
Image segmentation ajal
Image segmentation ajalImage segmentation ajal
Image segmentation ajal
 
Video Segmentation
Video SegmentationVideo Segmentation
Video Segmentation
 
Features image processing and Extaction
Features image processing and ExtactionFeatures image processing and Extaction
Features image processing and Extaction
 
various methods for image segmentation
various methods for image segmentationvarious methods for image segmentation
various methods for image segmentation
 

Similar to 08 cie552 image_segmentation

Lecture 9&10 computer vision segmentation-no_task
Lecture 9&10 computer vision segmentation-no_taskLecture 9&10 computer vision segmentation-no_task
Lecture 9&10 computer vision segmentation-no_taskcairo university
 
Image segmentation
Image segmentationImage segmentation
Image segmentationkhyati gupta
 
Conjugate Gradient method for Brain Magnetic Resonance Images Segmentation
Conjugate Gradient method for Brain Magnetic Resonance Images SegmentationConjugate Gradient method for Brain Magnetic Resonance Images Segmentation
Conjugate Gradient method for Brain Magnetic Resonance Images SegmentationEL-Hachemi Guerrout
 
OTSU Thresholding Method for Flower Image Segmentation
OTSU Thresholding Method for Flower Image SegmentationOTSU Thresholding Method for Flower Image Segmentation
OTSU Thresholding Method for Flower Image Segmentationijceronline
 
Image Segmentation.ppt
Image Segmentation.pptImage Segmentation.ppt
Image Segmentation.pptakshaya870130
 
Various object detection and tracking methods
Various object detection and tracking methodsVarious object detection and tracking methods
Various object detection and tracking methodssujeeshkumarj
 
Super Resolution of Image
Super Resolution of ImageSuper Resolution of Image
Super Resolution of ImageSatheesh K
 
ImageSegmentation (1).ppt
ImageSegmentation (1).pptImageSegmentation (1).ppt
ImageSegmentation (1).pptNoorUlHaq47
 
ImageSegmentation.ppt
ImageSegmentation.pptImageSegmentation.ppt
ImageSegmentation.pptAVUDAI1
 
ImageSegmentation.ppt
ImageSegmentation.pptImageSegmentation.ppt
ImageSegmentation.pptDEEPUKUMARR
 

Similar to 08 cie552 image_segmentation (20)

ImSeg04.ppt
ImSeg04.pptImSeg04.ppt
ImSeg04.ppt
 
ImSeg04 (2).ppt
ImSeg04 (2).pptImSeg04 (2).ppt
ImSeg04 (2).ppt
 
IR.pptx
IR.pptxIR.pptx
IR.pptx
 
regions
regionsregions
regions
 
IMAGE SEGMENTATION.
IMAGE SEGMENTATION.IMAGE SEGMENTATION.
IMAGE SEGMENTATION.
 
Image segmentation
Image segmentation Image segmentation
Image segmentation
 
Lecture 9&10 computer vision segmentation-no_task
Lecture 9&10 computer vision segmentation-no_taskLecture 9&10 computer vision segmentation-no_task
Lecture 9&10 computer vision segmentation-no_task
 
J017426467
J017426467J017426467
J017426467
 
Final Review
Final ReviewFinal Review
Final Review
 
Image segmentation
Image segmentationImage segmentation
Image segmentation
 
Conjugate Gradient method for Brain Magnetic Resonance Images Segmentation
Conjugate Gradient method for Brain Magnetic Resonance Images SegmentationConjugate Gradient method for Brain Magnetic Resonance Images Segmentation
Conjugate Gradient method for Brain Magnetic Resonance Images Segmentation
 
OTSU Thresholding Method for Flower Image Segmentation
OTSU Thresholding Method for Flower Image SegmentationOTSU Thresholding Method for Flower Image Segmentation
OTSU Thresholding Method for Flower Image Segmentation
 
Image Segmentation.ppt
Image Segmentation.pptImage Segmentation.ppt
Image Segmentation.ppt
 
Various object detection and tracking methods
Various object detection and tracking methodsVarious object detection and tracking methods
Various object detection and tracking methods
 
Super Resolution of Image
Super Resolution of ImageSuper Resolution of Image
Super Resolution of Image
 
ImageSegmentation (1).ppt
ImageSegmentation (1).pptImageSegmentation (1).ppt
ImageSegmentation (1).ppt
 
ImageSegmentation.ppt
ImageSegmentation.pptImageSegmentation.ppt
ImageSegmentation.ppt
 
ImageSegmentation.ppt
ImageSegmentation.pptImageSegmentation.ppt
ImageSegmentation.ppt
 
Digital Image Processing
Digital Image ProcessingDigital Image Processing
Digital Image Processing
 
Image segmentation
Image segmentationImage segmentation
Image segmentation
 

More from Elsayed Hemayed

14 cie552 camera_calibration
14 cie552 camera_calibration14 cie552 camera_calibration
14 cie552 camera_calibrationElsayed Hemayed
 
12 cie552 object_recognition
12 cie552 object_recognition12 cie552 object_recognition
12 cie552 object_recognitionElsayed Hemayed
 
11 cie552 image_featuresii_sift
11 cie552 image_featuresii_sift11 cie552 image_featuresii_sift
11 cie552 image_featuresii_siftElsayed Hemayed
 
10 cie552 image_featuresii_corner
10 cie552 image_featuresii_corner10 cie552 image_featuresii_corner
10 cie552 image_featuresii_cornerElsayed Hemayed
 
09 cie552 image_featuresi
09 cie552 image_featuresi09 cie552 image_featuresi
09 cie552 image_featuresiElsayed Hemayed
 
07 cie552 image_mosaicing
07 cie552 image_mosaicing07 cie552 image_mosaicing
07 cie552 image_mosaicingElsayed Hemayed
 
06 cie552 image_manipulation
06 cie552 image_manipulation06 cie552 image_manipulation
06 cie552 image_manipulationElsayed Hemayed
 
05 cie552 image_enhancement
05 cie552 image_enhancement05 cie552 image_enhancement
05 cie552 image_enhancementElsayed Hemayed
 
04 cie552 image_filtering_frequency
04 cie552 image_filtering_frequency04 cie552 image_filtering_frequency
04 cie552 image_filtering_frequencyElsayed Hemayed
 
03 cie552 image_filtering_spatial
03 cie552 image_filtering_spatial03 cie552 image_filtering_spatial
03 cie552 image_filtering_spatialElsayed Hemayed
 
02 cie552 image_andcamera
02 cie552 image_andcamera02 cie552 image_andcamera
02 cie552 image_andcameraElsayed Hemayed
 
Csci101 lect04 advanced_selection
Csci101 lect04 advanced_selectionCsci101 lect04 advanced_selection
Csci101 lect04 advanced_selectionElsayed Hemayed
 
Csci101 lect10 algorithms_iii
Csci101 lect10 algorithms_iiiCsci101 lect10 algorithms_iii
Csci101 lect10 algorithms_iiiElsayed Hemayed
 
Csci101 lect09 vectorized_code
Csci101 lect09 vectorized_codeCsci101 lect09 vectorized_code
Csci101 lect09 vectorized_codeElsayed Hemayed
 
Csci101 lect08b matlab_programs
Csci101 lect08b matlab_programsCsci101 lect08b matlab_programs
Csci101 lect08b matlab_programsElsayed Hemayed
 
Csci101 lect08a matlab_programs
Csci101 lect08a matlab_programsCsci101 lect08a matlab_programs
Csci101 lect08a matlab_programsElsayed Hemayed
 
Csci101 lect07 algorithms_ii
Csci101 lect07 algorithms_iiCsci101 lect07 algorithms_ii
Csci101 lect07 algorithms_iiElsayed Hemayed
 
Csci101 lect06 advanced_looping
Csci101 lect06 advanced_loopingCsci101 lect06 advanced_looping
Csci101 lect06 advanced_loopingElsayed Hemayed
 
Csci101 lect05 formatted_output
Csci101 lect05 formatted_outputCsci101 lect05 formatted_output
Csci101 lect05 formatted_outputElsayed Hemayed
 

More from Elsayed Hemayed (20)

14 cie552 camera_calibration
14 cie552 camera_calibration14 cie552 camera_calibration
14 cie552 camera_calibration
 
12 cie552 object_recognition
12 cie552 object_recognition12 cie552 object_recognition
12 cie552 object_recognition
 
11 cie552 image_featuresii_sift
11 cie552 image_featuresii_sift11 cie552 image_featuresii_sift
11 cie552 image_featuresii_sift
 
10 cie552 image_featuresii_corner
10 cie552 image_featuresii_corner10 cie552 image_featuresii_corner
10 cie552 image_featuresii_corner
 
09 cie552 image_featuresi
09 cie552 image_featuresi09 cie552 image_featuresi
09 cie552 image_featuresi
 
07 cie552 image_mosaicing
07 cie552 image_mosaicing07 cie552 image_mosaicing
07 cie552 image_mosaicing
 
06 cie552 image_manipulation
06 cie552 image_manipulation06 cie552 image_manipulation
06 cie552 image_manipulation
 
05 cie552 image_enhancement
05 cie552 image_enhancement05 cie552 image_enhancement
05 cie552 image_enhancement
 
04 cie552 image_filtering_frequency
04 cie552 image_filtering_frequency04 cie552 image_filtering_frequency
04 cie552 image_filtering_frequency
 
03 cie552 image_filtering_spatial
03 cie552 image_filtering_spatial03 cie552 image_filtering_spatial
03 cie552 image_filtering_spatial
 
02 cie552 image_andcamera
02 cie552 image_andcamera02 cie552 image_andcamera
02 cie552 image_andcamera
 
01 cie552 introduction
01 cie552 introduction01 cie552 introduction
01 cie552 introduction
 
Csci101 lect04 advanced_selection
Csci101 lect04 advanced_selectionCsci101 lect04 advanced_selection
Csci101 lect04 advanced_selection
 
Csci101 lect10 algorithms_iii
Csci101 lect10 algorithms_iiiCsci101 lect10 algorithms_iii
Csci101 lect10 algorithms_iii
 
Csci101 lect09 vectorized_code
Csci101 lect09 vectorized_codeCsci101 lect09 vectorized_code
Csci101 lect09 vectorized_code
 
Csci101 lect08b matlab_programs
Csci101 lect08b matlab_programsCsci101 lect08b matlab_programs
Csci101 lect08b matlab_programs
 
Csci101 lect08a matlab_programs
Csci101 lect08a matlab_programsCsci101 lect08a matlab_programs
Csci101 lect08a matlab_programs
 
Csci101 lect07 algorithms_ii
Csci101 lect07 algorithms_iiCsci101 lect07 algorithms_ii
Csci101 lect07 algorithms_ii
 
Csci101 lect06 advanced_looping
Csci101 lect06 advanced_loopingCsci101 lect06 advanced_looping
Csci101 lect06 advanced_looping
 
Csci101 lect05 formatted_output
Csci101 lect05 formatted_outputCsci101 lect05 formatted_output
Csci101 lect05 formatted_output
 

Recently uploaded

Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 

Recently uploaded (20)

Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 

08 cie552 image_segmentation

  • 2. Overview • Segmentation • Thresholding Segmentation Techniques • Segmentation as clustering • Mean shift segmentation 2Image Segmentation
  • 3. Image Segmentation • Goal: identify groups of pixels that go together 3Image Segmentation
  • 4. The Goals of Segmentation • Separate image into coherent “objects” 4
  • 5. The Goals of Segmentation • Separate image into coherent “objects” • Group together similar‐looking pixels for efficiency of further processing 5Image Segmentation
  • 6. Segmentation • Goal: to divide an image into parts that have a strong correlation with objects or areas of the real world, mainly objects and background. • A complete segmentation of an image R is a set of regions R1, R2, …, Rs iR S i R 1   ji RR  ji  6Image Segmentation
  • 7. Thresholding Segmentation Technique • Basic, Band, Multi, Semi-Thresholding • Threshold detection methods • Algorithms – Iterative (optimal) Threshold Selection – Otsu Segmentation Algorithm – Recursive multi-spectral thresholding
  • 8. Advantages • simplest segmentation process since Many objects or image regions are characterized by constant reflectivity or light absorption of their surface. • computationally inexpensive and fast and can easily be done in real time 8Image Segmentation
  • 9. Basic Thresholding • Basic thresholding of an input image f to an output image g is as follows: g(i,j) = 1 for f(i,j) g(i,j) = 0 for f(i,j) T T 9Image Segmentation
  • 10. Band Thresholding • There are several modifications on basic thresholding. They include: 1. Band thresholding: g(i,j) = 1 for f(i,j) f(i,j) g(i,j) = 0 otherwise • used e.g. in microscopic blood cells D 10Image Segmentation
  • 11. Multi-Thresholding 2. Multi-thresholding, using limited set of array levels: g(i,j) = 1 for f(i,j) g(i,j) = 2 for f(i,j) g(i,j) = 3 for f(i,j) . . . g(i,j) = n for f(i,j) g(i,j) = 0 otherwise 1 D 2 D 3 D nD 11Image Segmentation
  • 12. Semi-Thresholding 3. Semi-thresholding, masks out background g(i,j) = f(i,j) for f(i,j) g(i,j) = 0 for f(i,j) T T 12Image Segmentation
  • 13. Threshold Detection techniques • If some property of an image after segmentation is known a priori, the task of threshold selection is simplified, since the threshold is chosen to ensure this property is satisfied. • A main detection technique is based on Histogram shape analysis: – The chosen threshold is chosen to meet minimum segmentation error, by selecting it as the gray level that has minimum histogram value between the two maxima, that represent objects and background in the image. 13Image Segmentation
  • 14. Histogram shape analysis Distribution of Background Distribution of Objects Threshold Value 14Image Segmentation
  • 18. Histogram shape analysis (cont.) Distribution of Background Distribution of Objects Threshold Value ? 18Image Segmentation
  • 19. Histogram shape analysis • P-tile thresholding  Weighted histograms  Optimal thresholding 19Image Segmentation
  • 20. P-tile thresholding Threshold is selected such that p% of image pixels has gray values less than T. A good example is processing text pages. 20Image Segmentation
  • 21. One option is to weight histogram contribution: – Excluding pixels with high gradient values that represent edges will result in histogram with deeper valley and threshold will be easier to detect. – Building histogram for pixels with high gradient value only, the threshold value would be the peak of this histogram. Weighted histograms 21Image Segmentation
  • 22. Optimal thresholding It approximates histogram using two or more probabilities with normal distribution. The threshold is then the min probability between the maxima of the these normal distributions. It results in minimum error segmentation. 22Image Segmentation
  • 25. Brain MR Image Segmentation 25
  • 26. Apple Grading Results of segmentation by isodata thresholding. Fruits displayed are defected by scald (top- left), rot (top-right), frost damage (mid-left), bruise (mid-right), hail damage perfusion (bottom-left) and flesh damage (bottom-right). For each fruit its original RGB image, its manual segmentation (ground truth) and its segmentation results are displayed in a row. Defected areas are displayed in white in ground truth images, whereas segmentations show defected regions in gray color and healthy ones in white. Courtesy of D. UNAY, B. GOSSELIN, 2005, "Thresholding-based Segmentation and Apple Grading by Machine Vision", Proc. of EUSIPCO 2005, Antalya, Turkey. 26
  • 27. Algorithm: Iterative (optimal) Threshold Selection 1. As first iteration consider that the 4 corners contain background pixels only and the remainder contains object pixels. 2. Calculate and as the average intensity of background and object pixels. 3. At step t+1 segmentation is performed using the threshold t B t O 27Image Segmentation
  • 28. Iterative (optimal) Threshold Selection (cont.) 4. Re-calculate and according to new segmentation using: 5. Re-calculate 6. Stop if t B t O )()1( tt TT  28Image Segmentation
  • 29. Otsu’s Image Segmentation Algorithm • Find the threshold that minimizes the weighted within-class variance. • Equivalent to maximizing the between-class variance. • Operates directly on the gray level histogram [e.g. 256 numbers, P(i)] • It is fast (once the histogram is computed).
  • 30. Otsu: Assumptions • Histogram (and the image) are bimodal. • No use of spatial coherence, nor any other notion of object structure. • Assumes stationary statistics, but can be modified to be locally adaptive • Assumes uniform illumination (implicitly), so the bimodal brightness behavior arises from object appearance differences only.
  • 31. The weighted within-class variance is: w 2 (t)  q1(t)1 2 (t)  q2 (t)2 2 (t) Where the class probabilities are estimated as: q1(t)  P(i) i1 t    L ti iPtq 1 2 )()( 𝜇1(𝑡) = 1 𝑞1(𝑡) 𝑖=1 𝑡 𝑖𝑃(𝑖) 𝜇2(𝑡) = 1 𝑞2(𝑡) 𝑖=𝑡+1 𝐿 𝑖𝑃(𝑖) And the class means are given by: Otsu’s method: Formulation
  • 32. Finally, the individual class variances are: 1 2 (t)  [i  1(t)]2 P(i) q1(t)i1 t    L ti tq iP tit 1 2 2 2 2 2 )( )( )]([)(  Run through the full range of t values and pick the value that minimizes w 2 (t) Otsu’s method: Formulation w 2 (t)  q1(t)1 2 (t)  q2 (t)2 2 (t)
  • 34. Example (in presence of noise) Input image Histogram Global threshold Smoothened image Histogram Otsu’s method
  • 35. Image partitioning Input image Histogram Global threshold Global Otsu’s Method Image partitioning Local Otsu’s method
  • 36. Thresholding (non-uniform background) Input image Global thresholding using Otsu’s method Local thresholding with moving average
  • 37. 1. Initiallize the whole image as a single region. 2. Compute a smoothed histogram for each spectral band. 3. Find the most significant peak in each histogram and determine two thresholds on either sides of the peak. 4. Segment each region in each spectral band into sub-regions according to these thresholds. Algorithm: Recursive multi- spectral thresholding 40Image Segmentation
  • 39. 5. Project each segmentation into a multi- spectral segmentation. 6. Regions for the next processing steps are those in the multi-spectral image. 7. Repeat 2-6 until each histogram contains only one significat peak. Recursive multi-spectral thresholding (cont.): 42Image Segmentation
  • 41. Thresholding Based Segmentation Summary • Basic, Band, Multi, Semi-Thresholding • Threshold detection methods • Multi-spectral thresholding • Algorithms – Iterative (optimal) Threshold Selection – Recursive multi-spectral thresholding 44Image Segmentation
  • 43. Segmentation as clustering Encoding both similarity and proximity 46
  • 44. Image Intensity-based clusters Color-based clusters K-Means clustering • K-means clustering based on intensity or color is essentially vector quantization of the image attributes – Clusters don’t have to be spatially coherent 47
  • 45. K-Means pros and cons • Pros – Simple and fast – Converges to a local minimum of the error function • Cons – Need to pick K – Sensitive to initialization – Sensitive to outliers – Only finds “spherical” clusters 48Image Segmentation
  • 46. http://www.caip.rutgers.edu/~comanici/MSPAMI/msPamiResults.html Mean shift segmentation • An advanced and versatile technique for clustering-based segmentation D. Comaniciu and P. Meer, Mean Shift: A Robust Approach toward Feature Space Analysis, PAMI 2002. 49
  • 47. • The mean shift algorithm seeks a mode or local maximum of density of a given distribution – Choose a search window (width and location) – Compute the mean of the data in the search window – Center the search window at the new mean location – Repeat until convergence Mean shift algorithm 50Image Segmentation
  • 48. Region of interest Center of mass Mean Shift vector Mean shift 51Image Segmentation
  • 49. Region of interest Center of mass Mean Shift vector Mean shift 52Image Segmentation
  • 50. Region of interest Center of mass Mean Shift vector Mean shift 53Image Segmentation
  • 51. Region of interest Center of mass Mean Shift vector Mean shift 54Image Segmentation
  • 52. Region of interest Center of mass Mean Shift vector Mean shift 55Image Segmentation
  • 53. Region of interest Center of mass Mean Shift vector Mean shift 56Image Segmentation
  • 54. Region of interest Center of mass Mean shift 57Image Segmentation
  • 55. • Cluster: all data points in the attraction basin of a mode • Attraction basin: the region for which all trajectories lead to the same mode Mean shift clustering 58Image Segmentation
  • 56. • Find features (color, gradients, texture, etc) • Initialize windows at individual pixel locations • Perform mean shift for each window until convergence • Merge windows that end up near the same “peak” or mode Mean shift Clustering/segmentation 59Image Segmentation
  • 60. Mean shift pros and cons • Pros – Does not assume spherical clusters – Just a single parameter (window size) – Finds variable number of modes – Robust to outliers • Cons – Output depends on window size – Computationally expensive – Does not scale well with dimension of feature space 63Image Segmentation

Editor's Notes

  1. 45
  2. 46
  3. 47
  4. 48
  5. 49
  6. 50
  7. 51
  8. 52
  9. 53
  10. 54
  11. 55
  12. 56
  13. 57
  14. 58
  15. 59
  16. 60
  17. 61
  18. 62
  19. 63