Group-5 (Image Segmentation) - PPT
Group-5 (Image Segmentation) - PPT
Presented By:
❏ Image segmentation is dividing the image into groups of pixel based on some criteria
Or,
Image segmentation is the process of dividing an image into multiple segments (sets of pixels) to simplify its
representation and make it more meaningful for analysis.
How Does Image Segmentation Work?
❏ Object detection builds a bounding box corresponding to each class in the image. But it tells us nothing about the shape of the
object. We only get the set of bounding box coordinates. We want to get more information – this is too vague for our purposes.
❏ Image segmentation creates a pixel-wise mask for each object in the image. This technique gives us a far more granular
understanding of the object(s) in the image.
Another Example of Image Segmentation?
Fig:Cancerous cells
❏ Image segmentation is crucial for early cancer detection by precisely identifying the shape and
severity of cancerous cells, thus improving diagnosis and treatment.
❏ Traffic Control Systems: Enhances traffic monitoring and management.
❏ Self-Driving Cars: Improves object detection and navigation.etc
Types of Image Segmentation
Segmentation
instance
Semantic Panoptic
Semantic Segmentation
❏ Semantic segmentation is simply the task of assigning a class label to every single pixel of an
input image.
Instance segmentation
❏ Instance Segmentation is a computer vision task that involves identifying and separating individual
objects within an image, including detecting the boundaries of each object and assigning a unique
label to each object.
Panoptic Segmentation
Edge
Detection Roberts
Operator
Gaussian Gradient Prewitt
Based Edge Based Edge Operator
detection Sobel
Detection
Operator
Traditional Image Segmentation Techniques
Traditional
Techniques
Split-and-Merge
Clustering Methods Watershed Methods
Method
Split and Merge Method
• Calculate the distance of all the points from the center of each cluster
• Depending on this distance, the points are reassigned to the nearest cluster
Here,
Pixels values
T = (5+3+9+2+1+7+8+4+2)/9 =4.55(5)
5 3 9
Segmenting the image using T , we would get ,
2 1 7
G1 = {9,8,7} G2={5,3,2,1,4,2}
8 4 2
Finding the average ,we get,
m1=(9+8+7)/3=8
m2=(5+3+2+1+4+2)/6=2.83(3)
T=(8+3)/2 = 5.5(5)
Assingment :
7 3 4
Segmenting the Image Using
Global threshold method and 2 1 9
b) The goal is to partition the image into regions with similar characteristics, and the commonly
used algorithm is K-nearest neighbors.
c) The aim is to divide the population of pixels into distinct groups based on similarity, and the
commonly used algorithm is K-means clustering.
d) The objective is to label each pixel in the image according to predefined classes, and the
commonly used algorithm is Principal Component Analysis (PCA).
Code:
1.Clustering:(
https://colab.research.google.com/drive/1EncWK1PR_-3JDcLNTlMohZs
oS7eQvGt_#scrollTo=UcZTjcbCyImG
)
2.Watershed:(
https://colab.research.google.com/drive/1feDQ4QqSNK2j2AH2-bY7Hw
YnbhxxYVtH#scrollTo=WXV7-kx8rwXN
)
3.Threshold:(
https://colab.research.google.com/drive/1QhLvqpXBruR697REYi154j4
XF0RkXSoE?authuser=0#scrollTo=4zxEcmX5n5WV
)
Region-based Segmentation
Region-based segmentation is a technique in digital image processing (DIP) used to
partition an image into regions that are homogeneous according to some criteria.
Goal
To simplify the image representation into something that is more meaningful and
easier to analyze.
Can we jump?
Region-based Segmentation
There are four types of region-based segmentation. Those are as follows:
● 0 0 7 9 8
Seed point : (9, 1)
● Threshold : <= 4 0 1 8 8 9
1 2 8 8 9
For s=9,
f(x,y)-(x’,y’) <=4
B B A A A
f(x,y)-(9) <=2
f(x,y)={5,6,7,8,9}=A B B A A A
Resultant Image
For s=1, B B A A A
f(x,y)-(1) <=4
f(x,y)={0,1,2,3,4,5}=B B B A A A
B B A A A
Region growing Region growing segmentation
HW: For the given image, show the results of region growing
algorithm.Threshold,<=3.
4 5 4 5 3 5 5 4
6 6 4 4 5 3 4 3
6 7 7 6 6 3 5 3
5 6 4 7 3 6 4 5
2 0 1 1 5 7 4 3
1 2 0 2 4 4 5 5
0 2 1 1 3 5 6 4
1 0 1 0 4 5 3 7
Region splitting segmentation
❏ Split & Continue subdivision process until some stopping criteria is fulfilled
❏ Often it is stopped when no further splitting is possible
Region splitting segmentation
Region splitting segmentation
6 6 4 4 3 2 5 6
5 4 5 4 2 3 4 6
0 3 2 3 3 2 4 7 Min value : 0
Max value: 7
0 0 0 0 2 2 5 6 If (Max – min) > threshold, we have to
split the region.
1 1 0 1 0 3 4 4
Region splitting segmentation
6 5 6 6 7 7 6 6 Threshold: <= 3
6 7 6 7 5 5 4 7
If (Max – min) >
6 6 4 4 3 2 5 6
threshold, we have to
5 4 5 4 2 3 4 6 split the region.
0 3 2 3 3 2 4 7
Max-min=7-0=7>Threshold
0 0 0 0 2 2 5 6
1 1 0 1 0 3 4 4
1 0 1 0 2 3 5 4
Region splitting segmentation
6 5 6 6 7 7 6 6 6 5 6 6 7 7 6 6
6 7 6 7 5 5 4 7 6 7 6 7 5 5 4 7
6 6 4 4 3 2 5 6 6 6 4 4 3 2 5 6
5 4 5 4 2 3 4 6 5 4 5 4 2 3 4 6
0 3 2 3 3 2 4 7 0 3 2 3 3 2 4 7
0 0 0 0 2 2 5 6 0 0 0 0 2 2 5 6
1 1 0 1 0 3 4 4 1 1 0 1 0 3 4 4
1 0 1 0 2 3 5 4 1 0 1 0 2 3 5 4
Region Merging segmentation
• Region merging is the opposite of region splitting.
• Here we start from the pixel level and consider each of them as a homogeneous region.
• At any level of merging, we check if the four adjacent regions satisfy the homogeneous property.
If yes, they are merged to form a bigger region, otherwise the regions are left as they are.
• This is repeated until no further region exists that requires merging.
For checking 2 regions to be merged following criteria should be fulfilled at the same time :
1. The difference between Maximum pixel value of 1st region and the Minimum value of 2nd
region must no be greater than “Threshold” value.
2. The difference between Maximum pixel value of 2nd region and the Minimum value of 1st
region must no be greater than “Threshold” value.
* Check adjacent regions, if they are falling within the threshold, then merge.
Region Merging segmentation Example
Apply merge algorithm ,considering the Threshold value as <= 3
R2
6 5 6 6 7 7 6 6
R22
6 7 6 7 5 5R21 4 7
6 6 4 4 3 2 5 6
R23
R1 5 4 5 4 2 3 4 6 R24
0 3 2 3 3 2 4 7
0 0 0 0 2 2R41 5 6 R42
1 1 0 1 0 3 4 4
R3 1 0 1 0 2 3R43 5 4 R44
R4
Region Merging segmentation Example Cont.
R2
6 5 6 6 7 7 6 6 Step1 :
R21 R22 Check the adjacent of R1
R1 6 7 6 7 5 5 4 7
region. Adjacent are
6 6 4 4 3 2 5 6 R21,R23,R3.
R23
5 4 5 4 2 3 4 6 R24
Step 1.1: Check R1 and R21
0 3 2 3 3 2 4 7 Max of R1 = 7
0 0 0 0 2 2R41 5 6 R42 Min of R21= 5
Since , 7- 5 = 2 < Threshold
1 1 0 1 0 3 4 4
R3 Again,
1 0 1 0 2 R43
3 5 4 R44 Max of R21 = 7
Min of R1= 4
R4
Since , 7- 4 = 3 == Threshold
So, the regions should be
merged
Region Merging segmentation Example Cont.
R2 Step1 :
6 5 6 6 7 7 6 6 Check the adjacent of R1
R21 R22 region. Adjacent are
R1 6 7 6 7 5 5 4 7
R21,R23,R3.
6 6 4 4 3 2 5 6
R23 Step 1.2: Check R1 and R23
5 4 5 4 2 3 4 6 R24
Max of R1 = 7
0 3 2 3 3 2 4 7
Min of R23= 2
0 0 0 0 2 2R41 5 6 R42 Since , 7- 2 = 5 > Threshold
1 1 0 1 0 3 4 4
So, they remain separated
R3
1 0 1 0 2 R43
3 5 4 R44 Step1.3: Check R1 and R3
R4 Max of R1 = 7
Min of R3 = 0
Since , 7- 0 = 7 > Threshold
So,they remain separated
Region Merging segmentation Example Cont.
R2 Step2 :
6 5 6 6 7 7 6 6 Check the adjacent of R21
R21 R22 region. Adjacent are
R1 6 7 6 7 5 5 4 7
R22,R23.
6 6 4 4 3 2 5 6
R23
5 4 5 4 2 3 4 6 R24 Step 2.1: Check R21 and R22
0 3 2 3 3 2 4 7
Max of R21 = 7
Min of R22= 4
0 0 0 0 2 2R41 5 6 R42
Since , 7- 4 = 3 == Threshold
1 1 0 1 0 3 4 4 Again,
R3
R43 R44 Max of R22 = 7
1 0 1 0 2 3 5 4
Min of R21= 5
R4 Since , 7- 5 = 2 < Threshold
So, the regions should be
merged
Region Merging segmentation Example Cont.
R2
6 5 6 6 7 7 6 6
Step2 :
R21 R22 Check the adjacent of R21
R1 6 7 6 7 5 5 4 7
region. Adjacent are R22,R23.
6 6 4 4 3 2 5 6
R23
5 4 5 4 2 3 4 6 R24 Step 2.2: Check R21 and R23
0 3 2 3 3 2 4 7 Max of R21 = 7
R42 Min of R23= 2
0 0 0 0 2 2R41 5 6
Since , 7- 2 = 5 > Threshold
1 1 0 1 0 3 4 4
R3
So, the regions remains splitted
1 0 1 0 2 3R43 5 4 R44
R4
Region Merging segmentation Example Cont.
R2
6 5 6 6 7 7 6 6 Step3 :
R2 R22 Check the adjacent of R41
R1 6 7 6 7 5 51 4 7
region. Adjacent are
6 6 4 4 3 2 5 6 R3,R42,R43,R23
R23
5 4 5 4 2 3 4 6 R24
Step 3.1: Check R41 and R3
0 3 2 3 3 2 4 7 Max of R41 = 3
0 0 0 0 2 2R41 5 6 R42 Min of R3 = 0
Since , 3- 0 = 3 == Threshold
1 1 0 1 0 3 4 4
R3 Again,
1 0 1 0 2 R43
3 5 4 R44 Max of R3 = 3
Min of R41= 2
R4
Since , 3 - 2 = 1 < Threshold
So, the regions should be
merged
Region Merging segmentation Example Cont.
R2
6 5 6 6 7 7 6 6 Step3 :
R21 R22 Check the adjacent of R41 region.
R1 6 7 6 7 5 5 4 7
Adjacent are R3,R42,R43,R23
6 6 4 4 3 2 5 6
R23 Step 3.2: Check R41 and R42
5 4 5 4 2 3 4 6 R24
Max of R42 = 7
0 3 2 3 3 2 4 7 Min of R41 = 2
0 0 0 0 2 2R41 5 6 R42 Since , 7 - 2 = 5 > Threshold
So, region remain splitted.
1 1 0 1 0 3 4 4
R3
1 0 1 0 2 R43
3 5 4 R44 Step 3.3: Check R41 and R43
Max of R41 = 3
R4
Min of R43 = 2
Since , 3 - 2 = 1 < Threshold
So, the regions should be merged
Region Merging segmentation Example Cont.
R2
6 5 6 6 7 7 6 6 Step3 :
R21 R22 Check the adjacent of R41 region.
R1 6 7 6 7 5 5 4 7
Adjacent are R3,R42,R43,R23
6 6 4 4 3 2 5 6
R23 Step 3.4: Check R41 and R23
5 4 5 4 2 3 4 6 R24
Max of R41 = 3
0 3 2 3 3 2 4 7 Min of R23 = 1
R42
0 0 0 0 2 2R41 5 6 Since , 3 - 1 = 2 < Threshold
1 1 0 1 0 3 4 4
R3 Again,
1 0 1 0 2 3R43 5 4 Max of R23 = 3
R44 Min of R41 = 2
R4
Since , 3 - 2 = 1 < Threshold
So, the regions should be merged
Region Merging segmentation Example Cont.
R2
6 5 6 6 7 7 6 6 Step4 :
R21 R22 Check the adjacent of R43 region.
R1 6 7 6 7 5 5 4 7
Adjacent are R3,R44
6 6 4 4 3 2 5 6
R23 Step 4.4: Check R43 and R3
5 4 5 4 2 3 4 6 R24
Max of R43 = 3
0 3 2 3 3 2 4 7 Min of R3 = 0
R42
0 0 0 0 2 2R41 5 6 Since , 3 - 0 = 3 == Threshold
1 1 0 1 0 3 4 4
R3 Again,
1 0 1 0 2 3R43 5 4 Max of R3 = 3
R44 Min of R43 =0
R4
Since , 3 - 0 = 3 == Threshold
So, the regions should be merged
Region Merging segmentation Example Cont.
R2
6 5 6 6 7 7 6 6 Step4 :
R21 R22 Check the adjacent of R43 region.
R1 6 7 6 7 5 5 4 7
Adjacent are R3,R44
6 6 4 4 3 2 5 6
R23 Step 4.4: Check R43 and R44
5 4 5 4 2 3 4 6 R24
Max of R44 = 5
0 3 2 3 3 2 4 7 Min of R43 = 0
R42
0 0 0 0 2 2R41 5 6 Since , 5 - 0 = 5 > Threshold
1 1 0 1 0 3 4 4
R3 Remain, splitted.
1 0 1 0 2 3R43 5 4
R44
R4
Region Merging segmentation Example Cont.
R2
Step5 :
6 5 6 6 7 7 6 6 Check the adjacent of R24 region. Adjacent are
R21 R22 R22,R23,R42
R1 6 7 6 7 5 5 4 7
Step 5.1: Check R24 and R23
6 6 4 4 3 2 5 6
Max of R24 = 6
R23
5 4 5 4 2 3 4 6 R24 Min of R23 = 2
Since , 6 - 2 =4 > Threshold
0 3 2 3 3 2 4 7
R42 Step 5.2: Check R24 and R22
0 0 0 0 2 2R41 5 6 Max of R24 = 6
Min of R22 = 6
1 1 0 1 0 3 4 4 Since , 6 - 6 = 0 = < Threshold
R3 Again,
1 0 1 0 2 3R43 5 4
R44 Max of R22 = 7
R4 Min of R24 = 4
Since, 7 - 4 = 3 == Threshold
6 6 4 4 3 2 5 6
R23
5 4 5 4 2 3 4 6 R24
0 3 2 3 3 2 4 7
R42
0 0 0 0 2 R412 5 6
1 1 0 1 0 3 4 4
R3
1 0 1 0 2 R433 5 4
R44
R4
Region Merging segmentation Example Cont.
6 6 4 4 3 2 5 6
5 4 5 4 2 3 4 6
0 3 2 3 3 2 4 7
0 0 0 0 2 2 5 6
1 1 0 1 0 3 4 4
R2
1 0 1 0 2 3 5 4
Region splitting and Merging
segmentation
● Split based on given set of rules (threshold)
● Then merge the splitted area according to given set of rules (threshold).
Mathematical problem
5 6 6 6 7 7 6 6
6 7 6 7 5 5 4 7
6 6 4 4 3 2 5 6
5 4 5 4 2 3 4 6
0 3 2 3 3 2 4 7
0 0 0 0 2 2 5 6
1 1 0 1 0 3 4 4
1 0 1 0 2 3 5 4
5 6 6 6 7 7 6 6
6 7 6 7 5 5 4 7
6 6 4 4 3 2 5 6 Threshold : 3
5 4 5 4 2 3 4 6 Max value : 7
Min value : 0
0 3 2 3 3 2 4 7 Max-Min > 3, Therefore, we will
split the region into 4 region.
0 0 0 0 2 2 5 6
1 1 0 1 0 3 4 4
1 0 1 0 2 3 5 4
Mathematical problem (cont..)
R2
For region 2,
5 6 6 6 7 7 6 6
R1 Max value : 7
6 7 6 7 5 5 4 7 Min value : 2
Max-Min > 3, Therefore, we will split
6 6 4 4 3 2 5 6 the region into 4 region.
5 4 5 4 2 3 4 6
For region 4,
0 3 2 3 3 2 4 7 Max value : 7
Min value : 0
0 0 0 0 2 2 5 6
Max-Min > 3, Therefore, we will split
1 1 0 1 0 3 4 4 the region into 4 region.
R3
1 0 1 0 2 3 5 4
R4
Mathematical problem 2 (cont..)
Step1 :
Check the adjacent of R1
region. Adjacent are
R21 R22
R21,R23,R3.
R1 5 6 6 6 7 7 6 6
Step 1.1: Check R1 and R21
6 7 6 7 5 5 4 7 Max of R1 = 7
6 6 4 4 3 2 5 6 R24 Min of R21= 5
5 4 5 4 2
R23
3 4 6 Since , 7- 5 = 2 < Threshold
Again,
0 3 2 3 3 2 4 7
R41
Max of R21 = 7
R42
0 0 0 0 2 2 5 6 Min of R1= 4
1 1 0 1 0 3 4 4 Since , 7- 4 = 3 == Threshold
R3
So, the regions should be
1 0 1 0 2 3 5 4
merged
R43 R44
Mathematical problem 2 (cont..)
Step 1.2: Check R1 and R23
R21 R22
Max of R1 = 7
Min of R23= 2
5 6 6 6 7 7 6 6
R1 Since , 7- 2 = 5 > Threshold
6 7 6 7 5 5 4 7
6 6 4 4 3 2 5 6 R24
R23
5 4 5 4 2 3 4 6 Step 1.3: Check R1 and R3
Max of R1 = 7
0 3 2 3 3 2 4 7 Min of R3= 0
R41
0 0 0 0 2 2 5 6 R42 Since , 7- 0 = 5 > Threshold
1 1 0 1 0 3 4 4
R3 The regions remain splitted
1 0 1 0 2 3 5 4
R43 R44
Mathematical problem 2 (cont..)
Step2:
Check the adjacent of
R21 region. Adjacent are
R22,R23
R1 5 6 6 6 7 7 6 6 Step 2.1: Check R21 and R22
R21 R22
6 7 6 7 5 5 4 7 Max of R21 = 7
Min of R22= 4
6 6 4 4 3 2 5 6
R23 R24 Since , 7- 4 = 3 == Threshold
5 4 5 4 2 3 4 6 Again,
0 3 2 3 3 2 4 7 Max of R22 = 7
0 0 0 0 2
R41
2 5 6
Min of R21= 5
R3 Since , 7- 5 = 2 < Threshold
1 1 0 1 0 3 4 4 So, the regions should be
R44
1 0 1 0 2 3 5 4 merged
R43
Mathematical problem 2 (cont..)
Step2:
Check the adjacent of
R21 region. Adjacent are
R22,R23
R1 5 6 6 6 7 7 6 6 Step 2.2: Check R21 and R23
R21 R22
6 7 6 7 5 5 4 7 Max of R21 = 7
Min of R23 = 2
6 6 4 4 3 2 5 6
R23 R24 Since , 7- 2 = 5 >Threshold
5 4 5 4 2 3 4 6
0 3 2 3 3 2 4 7 So regions remain splitted
R41
0 0 0 0 2 2 5 6
R3
1 1 0 1 0 3 4 4
R44
1 0 1 0 2 3 5 4
R43
Mathematical problem 2 (cont..)
Step3:
Check the adjacent of R24
region. Adjacent are
R22,R23,R42
R43
Mathematical problem 2 (cont..)
Step 3.2: Check R24 and R23
Max of R24 = 6
Min of R23 = 2
Since , 6 - 2 = 4 > Threshold
R1 5 6 6 6 7 7 6 6
R21 R22
6 7 6 7 5 5 4 7 Step 3.3: Check R24 and
R42
6 6 4 4 3 2 5 6 Max of R24 = 6
R24
R23 Min of R42 = 4
5 4 5 4 2 3 4 6
Since 6- 4 = 2 < Threshold
0 3 2 3 3 2 4 7 Ahain,
R41 R42 Max of R42 = 7
0 0 0 0 2 2 5 6
Min of R24 = 4
R3
1 1 0 1 0 3 4 4 Sice , 7- 4 = 3 == Threshold
R44 So, The region should be
1 0 1 0 2 3 5 4 merged.
R43
Mathematical problem 2 (cont..)
Step4 :
Check the adjacent of R41 region.
Adjacent are R42,R3,R43,R23.
Step 4.1: Check R41 and R42
Max of R42 = 7
Min of R41 = 2
Since , 7 - 2 = 5 > Threshold
R1 5 6 6 6 7 7 6 6 So, Remain splitted.
R21 R22
6 7 6 7 5 5 4 7 Step 4.2: Check R41 and R3
6 6 4 4 3 2 5 6 Max of R3 = 3
R23 R24 Min of R41 = 2
5 4 5 4 2 3 4 6 Since 3 - 2 = 1 < Threshold
0 3 2 3 3 2 4 7 Again,
R41 R42 Max of R41 = 3
0 0 0 0 2 2 5 6 Min of R3 = 0
R3 Sice , 3 - 0 = 3 == Threshold
1 1 0 1 0 3 4 4
R44 So, The region should be
1 0 1 0 2 3 5 4 merged.
R43
Mathematical problem 2 (cont..)
Step4 :
Check the adjacent of R41 region.
Adjacent are R42,R43,R3,R23.
R1 5 6 6 6 7 7 6 6
R21 R22 Step 4.3: Check R41 and R43
6 7 6 7 5 5 4 7 Max of R41 = 3
6 6 4 4 3 2 5 6 Min of R43 = 0
R23 R24 Since , 3 - 0 = 3 == Threshold
5 4 5 4 2 3 4 6 Again,
0 3 2 3 3 2 4 7 Max of R43 = 3
R41 R42 Min of R41 = 2
0 0 0 0 2 2 5 6 Since , 3 - 2 = 1 < Threshold
R3 So, the regions should be merged.
1 1 0 1 0 3 4 4
R44
1 0 1 0 2 3 5 4
R43
Mathematical problem 2 (cont..)
Step4 :
Check the adjacent of R41 region.
Adjacent are R42,R43,R3,R23.
R1 5 6 6 6 7 7 6 6
R21 R22
6 7 6 7 5 5 4 7
6 6 4 4 3 2 5 6
R24 Step 4.4: Check R41 and R23
R23
5 4 5 4 2 3 4 6 Max of R41 = 3
Min of R23 = 2
0 3 2 3 3 2 4 7 Since , 3 - 2 = 1 < Threshold
R41 R42
0 0 0 0 2 2 5 6 Again,
R3 Max of R23 = 3
1 1 0 1 0 3 4 4 Min of R41 = 2
R44
1 0 1 0 2 3 5 4 Since , 3 - 2 = 1 < Threshold
So, the regions should be merged.
R43
Mathematical problem 2 (cont..)
Step5 :
Check the adjacent of R43 region.
Adjacent are R44,R3.
Step 5.1: Check R43 and R44
Max of R44 = 5
Min of R43= 0
Since , 5 - 0 = 5 > Threshold
R1 5 6 6 6 7 7 6 6 So, region should be splitted.
R21 R22
6 7 6 7 5 5 4 7
6 6 4 4 3 2 5 6 Step 5.2 : Check R43 and R3
R23 R24 Max of R43 = 3
5 4 5 4 2 3 4 6 Min of R3 = 0
Since , 3 - 0 = 3 ==Threshold
0 3 2 3 3 2 4 7
R41 R42
0 0 0 0 2 2 5 6 Again,
R3 Max of R3 = 3
1 1 0 1 0 3 4 4 Min of R43 = 0
R44 Since , 3 - 0 = 3 ==Threshold
1 0 1 0 2 3 5 4
So, the regions should be merged.
R43
Mathematical problem 2 (cont..)
Step6 :
Check the adjacent of R44 region.
Adjacent are R43,R42.
Step 6.1: Check R44 and R43
Already checked.
Regions should be splitted.
R1 5 6 6 6 7 7 6 6
R21 R22
6 7 6 7 5 5 4 7 Step 6.2 : Check R44 and R42
Max of R44 = 5
6 6 4 4 3 2 5 6 Min of R42 = 4
R23 R24
5 4 5 4 2 3 4 6 Since , 5 - 4 = 1 < Threshold
0 3 2 3 3 2 4 7 Again,
R41 R42 Max of R42 = 7
0 0 0 0 2 2 5 6 Min of R44 = 4
R3
1 1 0 1 0 3 4 4 Since , 7 - 4 = 3 ==Threshold
R44 So, the regions should be merged.
1 0 1 0 2 3 5 4
R43
Mathematical problem 2 (cont..)
R1 5 6 6 6 7 7 6 6
6 7 6 7 5 5 4 7
6 6 4 4 3 2 5 6
R2,4
5 4 5 4 2 3 4 6
0 3 2 3 3 2 4 7
R3,1
0 0 0 0 2 2 5 6
1 1 0 1 0 3 4 4
R4
1 0 1 0 2 3 5 4
R3,4
Mathematical problem 2 (cont..)
R1 5 6 6 6 7 7 6 6
6 7 6 7 5 5 4 7
6 6 4 4 3 2 5 6
5 4 5 4 2 3 4 6
0 3 2 3 3 2 4 7
0 0 0 0 2 2 5 6
1 1 0 1 0 3 4 4
R2
1 0 1 0 2 3 5 4
Code for Split and Merging
Segmentation
Colab Code link :
https://colab.research.google.com/drive/1BA9S25SGj-dUxY
VYt_N4hidCNsVt3KTV#scrollTo=CIXHbZfRRFZY
Outputs :
Mathematical Assignment
.
● Apply split segmentation and merging segmentation considering the
threshold value as <= 2
5 6 6 7 6 7 6 6
6 7 6 7 5 5 4 7
6 6 4 4 2 2 5 6
5 5 5 1 2 3 4 6
0 1 2 3 3 2 4 7
0 0 0 0 2 2 5 6
1 1 0 1 0 1 4 4
1 0 1 0 2 0 5 4
Edge and Edge detection
a. Step Edge: A sudden change in intensity, like the sharp boundary between black and
white areas. It looks like a step in a plot of pixel values.
b. Ramp Edge: A gradual change in intensity over a distance, resembling a slope in a plot. It
occurs in smooth transitions like shadows.
c. Roof Edge: A peak in intensity, similar to a ridge or hill in a plot. It appears in thin bright
lines against a darker background.
Edge Detection
● Gradient Based
○ Robert cross-gradient operators
○ Prewitt operators
○ Sobel Operators
● Gaussian Based
Gradient Based Edge detection
Gradient Operators
● Roberts Operator: Detects step edges by computing the gradient at each
pixel using diagonal differences. It's simple but sensitive to noise.
● Prewitt Operator: Detects step edges by using horizontal and vertical
gradients. It's based on averaging and is more robust to noise than Roberts.
● Sobel Operator: Detects step edges similar to Prewitt but includes a
smoothing effect. It's effective for reducing noise while detecting edges.
Gradient Based Edge detection
Cont.
Gradient is a vector ,
Gradient Based Edge detection Con.
This works on neighborhood concepts that considers differences between
them.
Here, gx and gy
represent the
gradients of the image
intensity in the
horizontal and vertical
directions.
Gradient Based Edge detection Con.
Sln:
Math Problem on Gradient Edge
detection
Math Problem on Gradient Edge
detection
Math Problem on Gradient Edge
detection
Code for Edge Detection Using
Sobel Operator
https://colab.research.google.com/drive/1_g2McBWkIIXB-EaVoB0NJl3K3WsIzJkM#sc
rollTo=ZSzrO6WAz1YM
Output :
Assignment on Edge detection
Perform Edge detection for the following picture using Prewitt operators
Applications of Image Segmentation
• Robotics (Machine Vision)
• Medical imaging
• Smart Cities
• Self Driving Cars
Robotics (Machine Vision)
Medical imaging
• X-Ray segmentation
• CT scan organ segmentation
• Dental instance segmentation
• Digital pathology cell segmentation
• Surgical video annotation
X-Ray segmentation
CT scan organ segmentation
Dental instance segmentation
Digital pathology cell segmentation
Surgical video annotation
Smart Cities
• Pedestrian detection
• Traffic analytics
• License plate detection
• Video Surveillance
Pedestrian detection
Traffic analytics
License plate detection
Video Surveillance
Self Driving Cars