0% found this document useful (0 votes)
66 views22 pages

Computer Vision: DR - Eng. Mahmoud Abu - Alfutuh

This chapter discusses image segmentation techniques. It introduces local and global segmentation approaches. Local segmentation seeks to detect edges within an image, while global segmentation creates regions directly by grouping similar pixels. The chapter covers edge detection methods like Sobel, Prewitt, and Canny operators. It also discusses region-based segmentation techniques including thresholding, region merging/splitting, and region growing. Code examples are provided to perform Canny edge detection and double thresholding on images.

Uploaded by

Mustafa Elmalky
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
0% found this document useful (0 votes)
66 views22 pages

Computer Vision: DR - Eng. Mahmoud Abu - Alfutuh

This chapter discusses image segmentation techniques. It introduces local and global segmentation approaches. Local segmentation seeks to detect edges within an image, while global segmentation creates regions directly by grouping similar pixels. The chapter covers edge detection methods like Sobel, Prewitt, and Canny operators. It also discusses region-based segmentation techniques including thresholding, region merging/splitting, and region growing. Code examples are provided to perform Canny edge detection and double thresholding on images.

Uploaded by

Mustafa Elmalky
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/ 22

Computer vision

Dr.Eng. Mahmoud Abu_alfutuh


Chapter 4
Segmentation
This chapter includes:
• Introduction
• Local Segmentation
• Global Segmentation
Machine vision system and Segmentation
• Segmentation is the initial stage for image
analysis, for recognition process.
Question: True (T) & False (F).
Circle one
1 Feature Extraction is the next step in machine vision system after T F
Segmentation
2 Segmentation is the next step in machine vision system after Image T F
Acquisition
3 We can extract the edge in the image Y using the command: T F
edge(‘ canny ', Y);
4 Segmentation algorithms are based on discontinuity or similarity. T F

5 Global Segmentation seeks to detect edges within an image. T F


6 Sobel Operator uses First Order Derivative for edge detection. T F
7 We can extract the edge in the image i using the command: T F
edge(i,‘ prewitt ');
Multiple choice questions
Circle one
1 Example of similarity approach in image segmentation is
  a Edge based c Boundary based segmentation
segmentation
  b Region based d Both a and c
segmentation
2 ______ refers to the process of partitioning an image into multiple
objects or parts.
  a Feature Extraction c Classification
  b Preprocessing d Segmentation
Multiple choice questions
Circle one
1 Response of Sobel mask is zero at
  a Sharp intensities c Constant intensities
  b Low intensities d High intensities

2 Matlab code to extract the edge in the image i is


  a w = edge(i,‘ gaussian '); c w = edge( ‘ gaussian ', i);
  b w = edge(i,‘ sobel '); d w = edge( ‘ sobel ', i);
Multiple choice questions
Circle one
Consider the following Image (F) which has integer intensities in the
range between 0 and 15, and then answer the following questions:

  4 3 2 2 4 2 2 3 4 2
Image F 2 4 3 4 3 2 3 4 2 2
3 2 3 4 4 4 2 2 4 3
1 Use Prewitt masks to compute the gradient (gx, gy) at the pixel F (2, 3) of
the image F.
  a gx= 2, gy= 1 c gx= 1, gy= 0
  b gx= 0, gy= 1 d gx= 1, gy= 1
2 Use Sobel masks to compute the gradient (gx, gy) at the pixel F (2, 3) of
the image F.
  a gx= 2, gy= 1 c gx= 3, gy= 1
  b gx= 1, gy= 3 d gx= 3, gy= 1
Sobel operators
the gradient at the pixel F (2, 3) :
g x = -1x3 - 2x2 -1x2 −𝟏
  −𝟐 −𝟏
+0x4 + 0x3 + 0x4 𝟎 𝟎 𝟎
+1x2+ 2x3 + 1x4 = 3 𝟏 𝟐 𝟏

 
−𝟏 𝟎 𝟏
g y = -1x3 + 0x2 +1x2
-2x4 + 0x3 + 2x4 −𝟐 𝟎 𝟐
-1x2 + 0x3 + 1x4 = 1
the gradient at the pixel F (2, 3) : −𝟏 𝟎 𝟏
 
𝑔𝑥 3
[ ] []
𝑔𝑦
=
1
Multiple choice questions
Circle one
Consider the following Image (F) which has integer intensities in the
range between 0 and 15, and then answer the following questions:
  4 3 2 2 4 2 2 3 4 2
Image F 2 4 3 4 3 2 3 4 2 2
3 2 3 4 4 4 2 2 4 3
1 Find the size of the image (F) in bytes
  a 15 c 30
  b 3.75 d 11.25
2 Find the intensity of the pixels F (2, 5) in the above image when using 3×3
Average filter
  a 1.93 c 19
  b 3.22 d 1.9
Multiple choice questions
Circle one
Consider the following Image (F) which has integer intensities in the
range between 0 and 15, and then answer the following questions:
  4 3 2 2 4 2 2 3 4 2
Image F 2 4 3 4 3 2 3 4 2 2
3 2 3 4 4 4 2 2 4 3
1 Find the histogram function at gray levels: 0, 2, 4. H(0), H(2), H(4)
  a H(0)=0, H(2)=11, H(4)=9 c H(0)=0, H(2)=10, H(4)=10
  b H(0)=0, H(2)=12, H(4)=10 d H(0)=0, H(2)=13, H(4)=10
2 Do histogram equalization on the image F, and then find the histogram
function at gray levels: 6, 10, and 15. H(6), H(10), H(15)
  a H(6)=8, H(10)=12, H(15)=10 c H(6)=12, H(10)=8, H(15)=10
  b H(6)=0, H(10)=12, H(15)=8 d H(6)=0, H(10)=12, H(15)=10
histogram equalization
• To equalize this histogram, we form running totals of the
ni, and multiply each by (L-1)/n = 15/30 =1/2:
• Grey level i 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
• ni 0 0 12 8 10 0
• total 0 0 12 20 30 30 30 30 30
• total × o.5 0 0 6 10 15 15 15 15
Multiple choice questions
Consider the following Image F which has integer intensities in the
range between 0 and 15, and then answer the following questions:
12 12 11 9 10 11 12 12
12 4 4 4 4 4 4 12
12 4 4 4 4 4 4 12
12 12 7 5 5 6 12 12

1 Find the two peeks of the histogram function of Image F and the
corresponding gray levels intensities
  a H(5)=12, H(12)=12 c H(7)=12, H(12)=12
  b H(4)=12, H(12)=12 d H(11)=12, H(12)=12
2 Find a Threshold value (T) to segment the image F
  a T=4 c T=8
  b T=5 d T=12
histogram
• Grey level i 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
• ni 0 0 0 0 12 2 1 1 1 1 2 12 0 0 0
Define image segmentation 
image segmentation is the process of partitioning a
digital image into multiple segments (objects).
Image segmentation is used to locate objects and
boundaries in images.
The result of image segmentation is a set of
segments, or a set of contours extracted from the
image.
Discus briefly main approaches used in Segmentation
Segmentation approaches are:
- Pixel-based or local method
- Region-based or global approach.
1. The pixel-based approach seeks to detect edges within an
image and then link them to create a boundary which
encloses a region of uniformity.
2. The region-based approach seeks to create regions
directly by grouping together pixels which share common
features into areas or regions of uniformity.
List the methods of edge detection
• First Order Derivative / Gradient Methods
– Sobel Operator
– Prewitt Operator
• Second Order Derivative
– Laplacian
– Laplacian of Gaussian
• Optimal Edge Detection
– Canny Edge DetectionM

17
Matlab code to find edges
• Write a Matlab code to find edges in grayscale image (circuit.tif)
using Canny operators. Shows the respective results.

• Matlab code
• >> ic=imread('circuit.tif ');
• >> c=edge(ic,‘ Canny ');
• >> subplot(1,2,1), imshow(ic), title('Original Image');
• >> subplot(1,2,2), imshow(c), title('Image after using Canny edge
detector')
List Region-based methods
Region-based methods are:
1. Image Thresholding
2. Region Merging and Splitting
3. Region Growing
Describe an algorithm for double thresholding a grayscale image. Write a
Matlab code to double threshold an image named (cell.tif), using threshold =
110 and 130. Shows the respective results.
•Algorithm for double thresholding a grayscale image
•For each pixel in the image do
• If (pixel_value > t1 and pixel_value < t2)
• then
• label the pixel as an object pixel;
• else
• label the pixel as a background pixel;
 
•Matlab code
•>> I=imread('cell.tif');
•>> imshow(I), figure, imshow(I>110 & I<130)
Write a 'split and merge algorithm' for segmenting an
image.
split and merge algorithm:
• It is a top-down approach and it starts with the assumption that
the entire image is homogeneous, If this is not true, the image is
split into four sub images
• If a region R is inhomogeneous, then is split into four sub regions
• If two adjacent regions Ri, Rj are homogeneous, they are merged
• The algorithm stops when no further splitting or merging is
possible
Thank you for listening

22

You might also like