100% found this document useful (1 vote)
60 views108 pages

Group-5 (Image Segmentation) - PPT

Image segmentation is the process of dividing an image into multiple segments to simplify its representation for analysis, with applications in cancer detection, traffic control, and self-driving cars. It includes various types such as semantic, instance, and panoptic segmentation, each serving different purposes in object detection and analysis. Traditional techniques for segmentation include clustering methods, watershed methods, and thresholding, which help in identifying and grouping pixels based on similarity.

Uploaded by

seriousimteaz63
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
60 views108 pages

Group-5 (Image Segmentation) - PPT

Image segmentation is the process of dividing an image into multiple segments to simplify its representation for analysis, with applications in cancer detection, traffic control, and self-driving cars. It includes various types such as semantic, instance, and panoptic segmentation, each serving different purposes in object detection and analysis. Traditional techniques for segmentation include clustering methods, watershed methods, and thresholding, which help in identifying and grouping pixels based on similarity.

Uploaded by

seriousimteaz63
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 108

Image Segmentation

Presented By:

Afrin Hayat 19CSE001


Md.Kilab Hossain 19CSE002
Md Al-Amin 19CSE016
Zahid Hasan 19CSE037
Nabiha Taieba Nuha 19CSE025
What is Image segmentation?

❏ 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?

Q- Which photos are more meaningful?

❏ It’s like breaking down an image into smaller pieces, like


objects, groups of pixels with similar characteristics, or
even individual pixels themselves.
What Is Image Segmentation Used For?

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

❏ There are three types of 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

❏ Panoptic segmentation is a computer vision technique that combines semantic segmentation


and instance segmentation to provide a detailed output of an image or video scene.
Quiz Part

Q-1. Which of the following best describes semantic instance segmentation?


a) Assigning a class label to each pixel in an image without distinguishing between different
instances of the same class.
b) Assigning a class label to each pixel in an image and distinguishing between different
instances of the same class.
c) Assigning a unique identifier to each object instance in an image.
d) Identifying the boundaries of objects in an image.

Q-2. What is the primary objective of panoptic segmentation in computer vision?


a) Segmenting objects based on their semantic categories.
b) Segmenting objects based on their instance identities.
c) Combining instance-aware and semantic segmentation into a unified framework.
d) Detecting objects in images and videos.
Relation Each Segmentation
Semantic segmentation vs Instance segmentation vs Panoptic
segmentation
Image Segmentation
Image Segmentation
Techniques Similarity
Discontinuity
[Partitioning according to [Partitioning based on similar regions
Abrupt changes] according to predefined criteria]

Edge Based Region


Clustering Thresholding
Based Based

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

❏ lt is an alternative method of image segmentation


❏ An image is subdivided into arbitrary disjoined region
❏ Arbitrary regions can be split and merged in order to satisfy the condition
Split and Merge Method

❏ It is known as Divide and Conquer approach


Clustering Methods
● Clustering is the task of dividing the population (data points) into
a number of groups, such that data points in the same groups are
more similar to other data points in that same group than those
in other groups. These groups are known as clusters.
K-means Clustering

One of the most commonly used clustering algorithms is k-means.


Here, the k represents the number of clusters (not to be confused with
k-nearest neighbor).
Working Principle:

• First, randomly select k initial clusters

• Randomly assign each data point to any one of the k clusters

• Calculate the centers of these clusters

• 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

• Calculate the center of the newly formed clusters


Mathematical Example :
Watershed Segmentation Methods

Start with all pixels with lowest possible value.

--These from the basis for initial watersheds


Watershed Segmentation
Methods

1) Histogram shape-based methods: where, for example, the peaks, valleys


and curvatures of the smoothed histogram are analyzed to calculate threshold
value.

2) Clustering-based methods: where the gray-level samples are clustered in


two parts as background and foreground (object), or alternately are modeled as a
mixture of two Gaussians
Thresholding

Thresholding is a type of image segmentation.


In this case, we can set a threshold value. The
pixel values falling below or above that
threshold can be classified accordingly (as an
object or the background). This technique is
known as Threshold Segmentation.
Category of thresholding

Global threshold : If we want to divide the image into


two regions (object and background), we define a single
threshold value. This is known as the global threshold.
Local threshold : If we have multiple objects along with
the background, we must define multiple thresholds.
These thresholds are collectively known as the local
threshold.Also known as Adaptive threshold method…
Procedures Of Global Threshold :

1.Select an initial Value for ‘T’.


2.Segment the image using T into 2 groups .
3.Compute the average value for m1 and m2 for
the pixel.
4. Compute the new threshold value from the
average of m1 and m2 .
Mathematical Problem :

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)

Then find out the new T ,

T=(8+3)/2 = 5.5(5)
Assingment :
7 3 4
Segmenting the Image Using
Global threshold method and 2 1 9

find out the threshold value 5 3 2


for the above image .
Quiz

What is the primary objective of clustering in image segmentation, and which


algorithm is commonly employed for this task?
a) The objective is to identify the edges of objects in an image, and the commonly used algorithm
is the Sobel operator.

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.

● Region based segmentation is a technique for determining the region correctly.


● The region-based segmentation method looks for similarities between adjacent
pixels.
● That is, pixels that possess similar attributes are grouped into unique regions.

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:

1. Region growing segmentation


2. Region splitting segmentation
3. Region merging segmentation
4. Region splitting and merging segmentation
Region growing segmentation
Region growing segmentation

Major steps of the region growing


algorithm are:
5*5
• Selection of the initial seed
• Seed growing criteria
• Termination of the segmentation process
End

Initial Regions Iterations Termination


Condition
❖ Groups pixels into larger Iterative process
regions ❖ How to start?
❖ Starts with a seed ❖ How to iterate?
region
❖ When to stop?
❖ Grows region by
merging
neighboring pixels
Region growing segmentation
1 0 7 8 8
Example: For the given image, show the results of region growing algorithm
0 1 8 9 8

● 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

★ Olt is an alternative method of image segmentation


★ An image is sub-divided into disjoint region

Major steps of the region splitting algorithm are:

❏ 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

• Region growing starts from a set of seed point.


• An Alternative is to start with the whole image as a single region and subdivide the
regions that do not satisfy a condition of homogeneity.

6 5 6 6 7 7 6 6 Example: For a given image, apply split and


merge algorithm
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 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

So, the regions should be merged


Region Merging segmentation Example Cont.
R2
6 5 6 6 7 7 6 6
R21 R22 Step 5.3: Check R24 and R42
R1 6 7 6 7 5 5 4 7 Max of R24 = 6
Min of R42 = 4
6 6 4 4 3 2 5 6
Since , 6 - 4 =2 < Threshold
R23
5 4 5 4 2 3 4 6 R24
Again,
0 3 2 3 3 2 4 7 Max of R42 = 7
R42 Min of R24 = 4
0 0 0 0 2 2R41 5 6 Since, 7 - 4 = 3 == Threshold

1 1 0 1 0 3 4 4 So, the regions should be merged


R3
1 0 1 0 2 3R43 5 4
R44
R4
Region Merging segmentation Example Cont.
R2 Step 6 :
6 5 6 6 7 7 6 6 Check the adjacent of R42 region. Adjacent are
R24,R41,R44
R21 R22
R1 6 7 6 7 5 5 4 7
Step 6.1 : Check R24 and R42
6 6 4 4 3 2 5 6 Already checked and merged.
R23
5 4 5 4 2 3 4 6 R24 Step 6.2 :Check R42 and R41
Max of R42 = 7
0 3 2 3 3 2 4 7 Min of R41 = 2
R42 Since , 7 - 2 = 5 > Threshold.
0 0 0 0 2 2R41 5 6 Remain splitted.

1 1 0 1 0 3 4 4 Step 6.3: Check R42 and R44


R3 Max of R42 = 7
1 0 1 0 2 3R43 5 4 Min of R44 = 4
R44 Since , 7 - 4 = 3 == Threshold.
R4 Again,
Max of R44 = 5
Min of R42 = 4
Since, 5 - 4 = 1 < Threshold
So, the regions should be merged .
Region Merging segmentation Example Cont.
R2
6 5 6 6 7 7 6 6
R21 R22
R1 6 7 6 7 5 5 4 7

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 5 6 6 7 7 6 6 Final Merged regions are depicted


in the figure
R1 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
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

● Apply region splitting and merging on the following image with


threshold value as 3

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

R1 5 6 6 6 7 7 6 6 Step 3.1: Check R24 and R22


R21 R22 Max of R24 = 6
6 7 6 7 5 5 4 7
Min of R22 = 4
6 6 4 4 3 2 5 6 Since , 6-4 = 2 <Threshold
R23 R24
5 4 5 4 2 3 4 6
Again,
0 3 2 3 3 2 4 7 Max of R22 = 7
R41 R42
0 0 0 0 2 2 5 6 Min of R24 = 4
R3 Since 7- 4 = 3 == Threshold
1 1 0 1 0 3 4 4 So, The region should be
R44
1 0 1 0 2 3 5 4 merged.

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

Edge : An edge can be defined as a set of connected pixels that formed a


boundary between two disjoint regions.

Edge detection : Edge detection is a fundamental technique in image processing


that aims to identify boundaries or edges between different objects or
regions within an image.
Edge Based Segmentation
From left to right,
Edge Models : models (ideal
representations) of a
step, a ramp, and a
roof edge, and their
corresponding
intensity profiles.
a b c

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.

Example of use of Gradient (Sobel operator)


Math Problem on Gradient Edge
detection
Detect edge in the following image using strength (magnitude) and direction of gradient.
Use Prewitt operator. Consider the pixel (1,1) as the point of interest.

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

• Drivable surface semantic segmentation


• Car and pedestrian instance segmentation
• In-vehicle object detection (stuff left behind by passengers)
• Pothole detection and segmentation
Drivable surface semantic segmentation
Car and pedestrian instance segmentation
In-vehicle object detection
Pothole detection and segmentation
Limitations
• Over segmentation and high sensitivity to noise.
• Takes more time for processing.
• redundant and get overlapped.
Thank you

You might also like