SlideShare a Scribd company logo
1 of 17
Digital Image Processing
Image Segmentation:
Thresholding
2
of
17
Contents
Today we will continue to look at the problem
of segmentation, this time though in terms of
thresholding
In particular we will look at:
– What is thresholding?
– Simple thresholding
– Adaptive thresholding
3
of
17
Thresholding
Thresholding is usually the first step in any
segmentation approach
We have talked about simple single value
thresholding already
Single value thresholding can be given
mathematically as follows:






T
y
x
f
if
T
y
x
f
if
y
x
g
)
,
(
0
)
,
(
1
)
,
(
4
of
17
Thresholding Example
Imagine a poker playing robot that needs to
visually interpret the cards in its hand
Original Image Thresholded Image
5
of
17
But Be Careful
If you get the threshold wrong the results
can be disastrous
Threshold Too Low Threshold Too High
6
of
17
Basic Global Thresholding
Based on the histogram of an image
Partition the image histogram using a single
global threshold
The success of this technique very strongly
depends on how well the histogram can be
partitioned
7
of
17
Basic Global Thresholding Algorithm
The basic global threshold, T, is calculated
as follows:
1. Select an initial estimate for T (typically the
average grey level in the image)
2. Segment the image using T to produce two
groups of pixels: G1 consisting of pixels
with grey levels >T and G2 consisting
pixels with grey levels ≤ T
3. Compute the average grey levels of pixels
in G1 to give μ1 and G2 to give μ2
8
of
17
Basic Global Thresholding Algorithm
4. Compute a new threshold value:
5. Repeat steps 2 – 4 until the difference in T
in successive iterations is less than a
predefined limit T∞
This algorithm works very well for finding
thresholds when the histogram is suitable
2
2
1 
 

T
9
of
17
Thresholding Example 1
Images
taken
from
Gonzalez
&
Woods,
Digital
Image
Processing
(2002)
10
of
17
Thresholding Example 2
Images
taken
from
Gonzalez
&
Woods,
Digital
Image
Processing
(2002)
11
of
17
Problems With Single Value
Thresholding
Single value thresholding only works for
bimodal histograms
Images with other kinds of histograms need
more than a single threshold
Images
taken
from
Gonzalez
&
Woods,
Digital
Image
Processing
(2002)
12
of
17
Problems With Single Value
Thresholding (cont…)
Let’s say we want to
isolate the contents
of the bottles,
Think about what the
histogram for this
image would look like,
What would happen if we used a single
threshold value?
Images
taken
from
Gonzalez
&
Woods,
Digital
Image
Processing
(2002)
13
of
17
Single Value Thresholding and
Illumination
Uneven illumination can really upset a single
valued thresholding scheme
Images
taken
from
Gonzalez
&
Woods,
Digital
Image
Processing
(2002)
14
of
17
Basic Adaptive Thresholding
An approach to handling situations in which
single value thresholding will not work is to
divide an image into sub images and
threshold these individually
Since the threshold for each pixel depends
on its location within an image this technique
is said to adaptive
15
of
17
Basic Adaptive Thresholding Example
The image below shows an example of using
adaptive thresholding with the image shown
previously
As can be seen success is mixed
But, we can further subdivide the troublesome
sub images for more success
16
of
17
Basic Adaptive Thresholding Example
(cont…)
These images show the
troublesome parts of the
previous problem further
subdivided
After this sub division
successful thresholding
can be
achieved
17
of
17
Summary
In this lecture we have begun looking at
segmentation, and in particular thresholding
We saw the basic global thresholding algorithm
and its shortcomings
We also saw a simple way to overcome some
of these limitations using adaptive thresholding

More Related Content

What's hot

Enhancement in spatial domain
Enhancement in spatial domainEnhancement in spatial domain
Enhancement in spatial domainAshish Kumar
 
Image Enhancement in Spatial Domain
Image Enhancement in Spatial DomainImage Enhancement in Spatial Domain
Image Enhancement in Spatial DomainA B Shinde
 
Frequency Domain Image Enhancement Techniques
Frequency Domain Image Enhancement TechniquesFrequency Domain Image Enhancement Techniques
Frequency Domain Image Enhancement TechniquesDiwaker Pant
 
Hough Transform By Md.Nazmul Islam
Hough Transform By Md.Nazmul IslamHough Transform By Md.Nazmul Islam
Hough Transform By Md.Nazmul IslamNazmul Islam
 
Digital Image restoration
Digital Image restorationDigital Image restoration
Digital Image restorationMd Shabir Alam
 
Image processing second unit Notes
Image processing second unit NotesImage processing second unit Notes
Image processing second unit NotesAAKANKSHA JAIN
 
Image Processing: Spatial filters
Image Processing: Spatial filtersImage Processing: Spatial filters
Image Processing: Spatial filtersA B Shinde
 
Chapter 3 image enhancement (spatial domain)
Chapter 3 image enhancement (spatial domain)Chapter 3 image enhancement (spatial domain)
Chapter 3 image enhancement (spatial domain)asodariyabhavesh
 
Edge Detection and Segmentation
Edge Detection and SegmentationEdge Detection and Segmentation
Edge Detection and SegmentationA B Shinde
 
Chapter 8 image compression
Chapter 8 image compressionChapter 8 image compression
Chapter 8 image compressionasodariyabhavesh
 
DIGITAL IMAGE PROCESSING - Visual perception - DAY 2
DIGITAL IMAGE PROCESSING - Visual perception - DAY 2DIGITAL IMAGE PROCESSING - Visual perception - DAY 2
DIGITAL IMAGE PROCESSING - Visual perception - DAY 2vijayanand Kandaswamy
 
Image Enhancement in Spatial Domain
Image Enhancement in Spatial DomainImage Enhancement in Spatial Domain
Image Enhancement in Spatial DomainDEEPASHRI HK
 
Digital Image Processing: An Introduction
Digital Image Processing: An IntroductionDigital Image Processing: An Introduction
Digital Image Processing: An IntroductionMostafa G. M. Mostafa
 
Color Image Processing: Basics
Color Image Processing: BasicsColor Image Processing: Basics
Color Image Processing: BasicsA B Shinde
 
digital image processing
digital image processingdigital image processing
digital image processingAbinaya B
 

What's hot (20)

Enhancement in spatial domain
Enhancement in spatial domainEnhancement in spatial domain
Enhancement in spatial domain
 
Image Enhancement in Spatial Domain
Image Enhancement in Spatial DomainImage Enhancement in Spatial Domain
Image Enhancement in Spatial Domain
 
Frequency Domain Image Enhancement Techniques
Frequency Domain Image Enhancement TechniquesFrequency Domain Image Enhancement Techniques
Frequency Domain Image Enhancement Techniques
 
Image segmentation
Image segmentationImage segmentation
Image segmentation
 
Hough Transform By Md.Nazmul Islam
Hough Transform By Md.Nazmul IslamHough Transform By Md.Nazmul Islam
Hough Transform By Md.Nazmul Islam
 
Digital Image restoration
Digital Image restorationDigital Image restoration
Digital Image restoration
 
Digital Image Processing
Digital Image ProcessingDigital Image Processing
Digital Image Processing
 
Image processing second unit Notes
Image processing second unit NotesImage processing second unit Notes
Image processing second unit Notes
 
Image Processing: Spatial filters
Image Processing: Spatial filtersImage Processing: Spatial filters
Image Processing: Spatial filters
 
Chapter 3 image enhancement (spatial domain)
Chapter 3 image enhancement (spatial domain)Chapter 3 image enhancement (spatial domain)
Chapter 3 image enhancement (spatial domain)
 
Edge Detection and Segmentation
Edge Detection and SegmentationEdge Detection and Segmentation
Edge Detection and Segmentation
 
Chapter 8 image compression
Chapter 8 image compressionChapter 8 image compression
Chapter 8 image compression
 
Canny Edge Detection
Canny Edge DetectionCanny Edge Detection
Canny Edge Detection
 
Image compression
Image compression Image compression
Image compression
 
DIGITAL IMAGE PROCESSING - Visual perception - DAY 2
DIGITAL IMAGE PROCESSING - Visual perception - DAY 2DIGITAL IMAGE PROCESSING - Visual perception - DAY 2
DIGITAL IMAGE PROCESSING - Visual perception - DAY 2
 
Image Enhancement in Spatial Domain
Image Enhancement in Spatial DomainImage Enhancement in Spatial Domain
Image Enhancement in Spatial Domain
 
Digital Image Processing: An Introduction
Digital Image Processing: An IntroductionDigital Image Processing: An Introduction
Digital Image Processing: An Introduction
 
Region based segmentation
Region based segmentationRegion based segmentation
Region based segmentation
 
Color Image Processing: Basics
Color Image Processing: BasicsColor Image Processing: Basics
Color Image Processing: Basics
 
digital image processing
digital image processingdigital image processing
digital image processing
 

Similar to ImageProcessing10-Segmentation(Thresholding) (1).ppt

Image processing9 segmentation(pointslinesedges)
Image processing9 segmentation(pointslinesedges)Image processing9 segmentation(pointslinesedges)
Image processing9 segmentation(pointslinesedges)John Williams
 
Image processing
Image processingImage processing
Image processingabuamo
 
BMVA summer school MATLAB programming tutorial
BMVA summer school MATLAB programming tutorialBMVA summer school MATLAB programming tutorial
BMVA summer school MATLAB programming tutorialpotaters
 
Image processing3 imageenhancement(histogramprocessing)
Image processing3 imageenhancement(histogramprocessing)Image processing3 imageenhancement(histogramprocessing)
Image processing3 imageenhancement(histogramprocessing)John Williams
 
Analysis and Design of Algorithms notes
Analysis and Design of Algorithms  notesAnalysis and Design of Algorithms  notes
Analysis and Design of Algorithms notesProf. Dr. K. Adisesha
 
primal and dual problem
primal and dual problemprimal and dual problem
primal and dual problemYash Lad
 
Introduction to Applied Machine Learning
Introduction to Applied Machine LearningIntroduction to Applied Machine Learning
Introduction to Applied Machine LearningSheilaJimenezMorejon
 

Similar to ImageProcessing10-Segmentation(Thresholding) (1).ppt (12)

Image processing9 segmentation(pointslinesedges)
Image processing9 segmentation(pointslinesedges)Image processing9 segmentation(pointslinesedges)
Image processing9 segmentation(pointslinesedges)
 
Image processing
Image processingImage processing
Image processing
 
Digital Image Processing
Digital Image ProcessingDigital Image Processing
Digital Image Processing
 
Himadeep
HimadeepHimadeep
Himadeep
 
BMVA summer school MATLAB programming tutorial
BMVA summer school MATLAB programming tutorialBMVA summer school MATLAB programming tutorial
BMVA summer school MATLAB programming tutorial
 
JPEG
JPEGJPEG
JPEG
 
Dip day1&2
Dip day1&2Dip day1&2
Dip day1&2
 
Image processing3 imageenhancement(histogramprocessing)
Image processing3 imageenhancement(histogramprocessing)Image processing3 imageenhancement(histogramprocessing)
Image processing3 imageenhancement(histogramprocessing)
 
Analysis and Design of Algorithms notes
Analysis and Design of Algorithms  notesAnalysis and Design of Algorithms  notes
Analysis and Design of Algorithms notes
 
Data compression
Data compressionData compression
Data compression
 
primal and dual problem
primal and dual problemprimal and dual problem
primal and dual problem
 
Introduction to Applied Machine Learning
Introduction to Applied Machine LearningIntroduction to Applied Machine Learning
Introduction to Applied Machine Learning
 

Recently uploaded

costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsAndrey Dotsenko
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 

Recently uploaded (20)

costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 

ImageProcessing10-Segmentation(Thresholding) (1).ppt

  • 1. Digital Image Processing Image Segmentation: Thresholding
  • 2. 2 of 17 Contents Today we will continue to look at the problem of segmentation, this time though in terms of thresholding In particular we will look at: – What is thresholding? – Simple thresholding – Adaptive thresholding
  • 3. 3 of 17 Thresholding Thresholding is usually the first step in any segmentation approach We have talked about simple single value thresholding already Single value thresholding can be given mathematically as follows:       T y x f if T y x f if y x g ) , ( 0 ) , ( 1 ) , (
  • 4. 4 of 17 Thresholding Example Imagine a poker playing robot that needs to visually interpret the cards in its hand Original Image Thresholded Image
  • 5. 5 of 17 But Be Careful If you get the threshold wrong the results can be disastrous Threshold Too Low Threshold Too High
  • 6. 6 of 17 Basic Global Thresholding Based on the histogram of an image Partition the image histogram using a single global threshold The success of this technique very strongly depends on how well the histogram can be partitioned
  • 7. 7 of 17 Basic Global Thresholding Algorithm The basic global threshold, T, is calculated as follows: 1. Select an initial estimate for T (typically the average grey level in the image) 2. Segment the image using T to produce two groups of pixels: G1 consisting of pixels with grey levels >T and G2 consisting pixels with grey levels ≤ T 3. Compute the average grey levels of pixels in G1 to give μ1 and G2 to give μ2
  • 8. 8 of 17 Basic Global Thresholding Algorithm 4. Compute a new threshold value: 5. Repeat steps 2 – 4 until the difference in T in successive iterations is less than a predefined limit T∞ This algorithm works very well for finding thresholds when the histogram is suitable 2 2 1     T
  • 11. 11 of 17 Problems With Single Value Thresholding Single value thresholding only works for bimodal histograms Images with other kinds of histograms need more than a single threshold Images taken from Gonzalez & Woods, Digital Image Processing (2002)
  • 12. 12 of 17 Problems With Single Value Thresholding (cont…) Let’s say we want to isolate the contents of the bottles, Think about what the histogram for this image would look like, What would happen if we used a single threshold value? Images taken from Gonzalez & Woods, Digital Image Processing (2002)
  • 13. 13 of 17 Single Value Thresholding and Illumination Uneven illumination can really upset a single valued thresholding scheme Images taken from Gonzalez & Woods, Digital Image Processing (2002)
  • 14. 14 of 17 Basic Adaptive Thresholding An approach to handling situations in which single value thresholding will not work is to divide an image into sub images and threshold these individually Since the threshold for each pixel depends on its location within an image this technique is said to adaptive
  • 15. 15 of 17 Basic Adaptive Thresholding Example The image below shows an example of using adaptive thresholding with the image shown previously As can be seen success is mixed But, we can further subdivide the troublesome sub images for more success
  • 16. 16 of 17 Basic Adaptive Thresholding Example (cont…) These images show the troublesome parts of the previous problem further subdivided After this sub division successful thresholding can be achieved
  • 17. 17 of 17 Summary In this lecture we have begun looking at segmentation, and in particular thresholding We saw the basic global thresholding algorithm and its shortcomings We also saw a simple way to overcome some of these limitations using adaptive thresholding