๐ Iterative Thresholding
B.Sc. Computer Science Honours | Digital Image Processing & Image Segmentation
๐ 1. Introduction
Iterative Thresholding, also called the Iterative Selection Method, is an image segmentation technique used to automatically determine a suitable threshold value from the intensity distribution of an image.
Instead of choosing the threshold manually, the algorithm starts with an initial estimate and repeatedly improves the threshold until the value becomes stable.
Image
Two Groups
Means
Threshold
Threshold
⚙️ 2. Basic Principle
Let the grayscale image contain pixel intensities represented by f(x,y).
Choose an initial threshold T. The pixels are divided into two groups:
Calculate the mean intensity of each group:
Then calculate a new threshold:
The process continues until the threshold becomes stable.
๐ง 3. Iterative Thresholding Algorithm
๐ 4. Complete Flow of Iterative Thresholding
T
๐ข 5. Numerical Example
Consider the following simplified set of grayscale pixel values:
Assume the initial threshold is:
Iteration 1
Using T = 100:
| Group | Pixel Values | Mean |
|---|---|---|
| G₁ > 100 | 150, 160, 170, 180, 190 | 170 |
| G₂ ≤ 100 | 20, 30, 40, 50, 60 | 40 |
New threshold:
Iteration 2
Using T = 105, the groups remain unchanged.
๐ฏ 6. Convergence Condition
The algorithm stops when the difference between consecutive threshold values becomes sufficiently small.
Here, ฮต is a small tolerance value.
๐ 7. Mathematical Formulation
Let the image contain N pixels and let the threshold at iteration k be Tk.
The two groups are:
The group means are:
Then:
๐งช 8. Interactive Iterative Thresholding Calculator
๐งฉ 9. 8×8 Image Matrix Demonstration
The following interactive matrix represents a simplified grayscale image. Iterative thresholding will automatically calculate a threshold from the matrix.
๐ 10. Beginner Python Implementation
The following Python program implements iterative thresholding without using a built-in automatic thresholding function.
๐ 11. Python Code Explanation
๐ 12. Example Iteration Table
| Iteration | Old T | ฮผ₁ | ฮผ₂ | New T |
|---|---|---|---|---|
| 1 | 100 | 170 | 40 | 105 |
| 2 | 105 | 170 | 40 | 105 |
๐ 13. Global vs Iterative Thresholding
| Feature | Global Thresholding | Iterative Thresholding |
|---|---|---|
| Threshold | Usually manually selected | Calculated iteratively |
| Process | Single threshold operation | Repeated refinement |
| Automatic Selection | Not necessarily | Yes, from image statistics |
| Computation | Low | Higher than one-pass thresholding |
| Result | Binary segmentation | Binary segmentation using converged T |
๐ 14. Iterative Thresholding vs Otsu's Method
| Feature | Iterative Thresholding | Otsu's Method |
|---|---|---|
| Basic Idea | Repeatedly updates T using group means | Selects T using a histogram-based class-separation criterion |
| Starting Value | Usually requires an initial T | Evaluates candidate thresholds |
| Iterations | Yes | Not iterative in the same sense |
| Statistics | Two class means | Class probabilities and variances |
| Automatic | Yes | Yes |
๐ 15. Applications
๐ Document Processing
Separating text and background in scanned documents.
๐ข OCR
Preparing characters for optical character recognition.
๐งฌ Medical Image Analysis
Separating regions of interest based on intensity.
๐ญ Industrial Inspection
Separating objects or defects from backgrounds.
๐ฐ️ Remote Sensing
Intensity-based separation of image regions.
๐ฌ Scientific Images
Segmenting objects with distinguishable intensity ranges.
✅ 16. Advantages
⚠️ 17. Limitations
⏱️ 18. Computational Consideration
If the image contains N pixels and the algorithm performs K iterations, a straightforward implementation requires approximately:
In practice, the number of iterations is usually relatively small for many simple images, but it depends on the image distribution, initial threshold and stopping condition.
๐ 19. Algorithm in Short
T₀
G₁,G₂
ฮผ₁,ฮผ₂
๐ 20. Important Examination Points
๐ 21. Quick Revision Table
| Concept | Key Point |
|---|---|
| Initial Threshold | Starting estimate of T. |
| G₁ | Pixels greater than T. |
| G₂ | Pixels less than or equal to T. |
| ฮผ₁ | Mean intensity of G₁. |
| ฮผ₂ | Mean intensity of G₂. |
| New Threshold | Tnew = (ฮผ₁ + ฮผ₂) / 2. |
| Stopping Condition | |Tnew − Told| < ฮต. |
| Final Result | Thresholded / segmented image. |