6 Image Segmentation
6 Image Segmentation
Segmentation
Image Segmentation
• It takes into account factors such as image noise and the nature of edges.
• During that time: edge detection was mainly based on small operators such as the Sobel,
Robert, Prewitt masks
Marr-Hildreth edge detector
• Marr and Hildreth argued that the most satisfactory operator is the Laplacian of a
Gaussian (LoG)
2 2
𝜕 𝜕
∇2 = 2 + 2
𝜕𝑥 𝜕𝑦
𝑥 2 +𝑦 2
−
𝐺(𝑥, 𝑦) = 𝑒 2𝜎2
Marr-Hildreth edge detector
2
𝑥 + 𝑦 − 2𝜎 2 2 𝑥 2 +𝑦 2
2 −
∇ 𝐺(𝑥, 𝑦) = 𝑒 2𝜎2
𝜎4
Fundamental ideas:
• the Gaussian part blurs the image, reducing structures/noise
• unlike average masks, Gaussian filter is smooth in both the spatial and frequency
domains
Fundamental ideas:
• second part: the Laplacian part is isotropic, invariant to rotation
• no need to use multiple masks like first derivative cases, since isotropic
Marr-Hildreth edge detector
Algorithm:
1. Filter the input image with an nxn Gaussian lowpass filter
2. Compute the Laplacian of the image resulting from Step 1.
3. Find the zero crossings of the image from Step 2.
Marr-Hildreth edge detector
• Size of the mask: about 99.7% of the volume under a 2-D Gaussian surface lies
between ±3𝜎 about the mean.
• The value of n should be the smallest odd integer greater than or equal to 6 𝜎
Marr-Hildreth edge detector
• Sometimes, the absolute value of opposing neighbor’s numerical difference must also
exceed the threshold.
Marr-Hildreth edge detector
Marr-Hildreth edge detector
𝑥 2 +𝑦 2 𝑥 2 +𝑦 2
1 −
2𝜎 2 1 −
2𝜎 2
𝐷𝑜𝐺(𝑥, 𝑦) = 𝑒 1 − 𝑒 2
2𝜋𝜎12 2𝜋𝜎22
𝜎1 > 𝜎2
The value of σ for the LoG
Marr-Hildreth edge detector
Marr-Hildreth edge detector
• First smoothing the image with a circular 2-D Gaussian function, then computing
the gradient image 𝑥 2 +𝑦 2
−
𝐺(𝑥, 𝑦) = 𝑒 2𝜎2
𝑓𝑠 (𝑥, 𝑦) = 𝐺(𝑥, 𝑦) ∗ 𝑓(𝑥, 𝑦)
All the nonzero pixels of former image will be contained in the later image
• These edge pixels have gaps (broken edges); so longer edges are
formed using the next procedure
Canny edge detector
• Locate the next unvisited edge pixel p in 𝑔𝑁𝐻 (𝑥, 𝑦)
•All the weak edge pixels in 𝑔𝑁𝐿 (𝑥, 𝑦) that are 8-connected to p, are
marked as valid edge pixels
• If all non-zero pixels in 𝑔𝑁𝐻 (𝑥, 𝑦) have been visited go to next step, else
go to step 1.
Canny edge detector
• Set rest weak edge pixels in 𝑔𝑁𝐿 (𝑥, 𝑦) that were not marked as valid
edge pixels to zero
• Final edge image is formed by appending to 𝑔𝑁𝐿 (𝑥, 𝑦) all the nonzero
pixels from 𝑔𝑁𝐻 (𝑥, 𝑦)
Canny edge detector
Summary
• Smooth the input image with a Gaussian filter
• Compute the gradient magnitude and angle images
• Apply Non-maxima suppression to the gradient image
• Use Double thresholding (Hysteresis Thresholding) and connectivity
analysis to detect and link edges
Canny edge detector
Canny edge detector
Edge Linking
• Edges and thresholds sometimes do not give good results for segmentation.
• Region-based segmentation is based on the connectivity of similar pixels in a region.
– Each region must be uniform.
– Connectivity of the pixels within the region is very important.
• There are two main approaches to region-based segmentation: region growing and
region splitting.
Region Growing
Thresholding still produces isolated image
Region growing algorithms works on principle of similarity
It states that a region is coherent if all the pixels of that region are homogeneous with
respect to some characteristics such as color, intensity, texture, or other statistical
properties
Thus idea is to pick a pixel inside a region of interest as a starting point (also known as a
seed point) and allowing it to grow
Seed point is compared with its neighbors, and if the properties match , they are
merged together
This process is repeated till the regions converge to an extent that no further merging is
possible
Region Growing Algorithm