Segmentation, Edge& Line Detection: Step in Image Analysis
Segmentation, Edge& Line Detection: Step in Image Analysis
Al-Rawi
University of Anbar\ College Of Computer Science& I.T
Graduate studying (Master)
Lec.9
1
Dr.Azmi T.Al-Rawi
University of Anbar\ College Of Computer Science& I.T
Graduate studying (Master)
Lec.9
Applications:
• Machine Vision
• Medical Imaging applications (tumor delineation,)
• Object detection (face detection,…)
• 3D Reconstruction
• Object/Motion Tracking
• Object-based measurements such as size and shape
• Object recognition (face recognition,…)
• Fingerprint recognition,
• Video surveillance
2
Dr.Azmi T.Al-Rawi
University of Anbar\ College Of Computer Science& I.T
Graduate studying (Master)
Lec.9
Image Binarization:
Image binarization applies often just one global threshold T for mapping
a scalar image I into a binary image.
Thresholding is a vital part of image segmentation, where we wish to
isolate objects from the background. A grayscale image is turned into a
binary (black and white) image according to whether its grey value is
greater than or less than T as shown in figure 2.
A pixels become becomes white if its gray level > T.
A pixels become becomes black if its gray level <=T
0 𝑖𝑓 𝐼(𝑥, 𝑦) ≤ 𝑇
𝑓 (𝑥, 𝑦) = { }
1 𝑜𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
3
Dr.Azmi T.Al-Rawi
University of Anbar\ College Of Computer Science& I.T
Graduate studying (Master)
Lec.9
A pixels become becomes white its gray level between T1 and T2.
A pixels become becomes black if its gray level is otherwise.
This called double thresholding as shown if figure 5.
4
Dr.Azmi T.Al-Rawi
University of Anbar\ College Of Computer Science& I.T
Graduate studying (Master)
Lec.9
5
Dr.Azmi T.Al-Rawi
University of Anbar\ College Of Computer Science& I.T
Graduate studying (Master)
Lec.9
The task is to define a threshold level T that would minimize the overall
segmentation error.
6
Dr.Azmi T.Al-Rawi
University of Anbar\ College Of Computer Science& I.T
Graduate studying (Master)
Lec.9
Region:
- A group of connected pixels with similar properties.
-Closed boundaries.
-Computation of regions is based on similarity.
-Regions may correspond to Objects in a scene or parts of objects.
- Spatial proximity + similarity.
For segment generation in grey-level or color images, we may start at one
seed pixel (x,y, I(x,y)) and add recursively adjacent pixels that satisfy a
“similarity criterion” with pixels contained in the so-far grown region
around the seed pixel.
|𝑧(𝑥, 𝑦) − 𝑚𝑖 | ≤ 2𝜎𝑖
where: z(x,y) is a gray level in (x,y) coordinate, mi , σi are the mean and
standard variation of the analyzed region.
Seeded Segmentation (Region Growing)
1. Choose the seed pixel
2. Check the neighboring pixels and add them to the region if they are
similar to the seed
3. Repeat step 2 for each of the newly added pixels; stop if no more pixels
can be added
2- Clustering methods.
The clustering techniques can be applied to any domain, such as
any N-dimensional color or feature space, whose components may even
include the spatial domain’s (r,c) coordinates.
The region growing and shrinking category can be considered a subset
of the clustering methods, but is limited to the spatial domain.
What is clustering?
Organizing data into classes such that:
– High intra-class similarity.
– Low inter-class similarity.
Finding the class labels and the number of classes directly from the
data (as opposed to classification tasks).
What is similarity?
Cluster by features
• Color • Intensity • Location • Texture.
There are different methods and one of the most popular methods is K-
Means clustering algorithm.
The objective of K-Means clustering is to minimize the sum of squared
distances between all points and the cluster center.
Steps in K-Means algorithm:
1. Choose the number of clusters K.
2. Select at random K points, the centroids(not necessarily from your
dataset).
3. Assign each data point to the closest centroid → that forms K clusters.
4. Compute and place the new centroid of each cluster.
5. Reassign each data point to the new closest centroid. If any
reassignment. took place, go to step 4, otherwise, the model is ready.