0% found this document useful (0 votes)
21 views

Lecture_2(DIP) (1)

Uploaded by

Tanbin Ahmed Ovi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Lecture_2(DIP) (1)

Uploaded by

Tanbin Ahmed Ovi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 48

E C E

Digital Image Processing


ECE-4223

Oishi Jyoti
Lecturer
Dept. of ECE, RUET
Reference Book

 Digital Image Processing (4th Edition) – Rafael C Gonzalez, Richard E Woods


(Chapter – 9 )
Connected Component Extraction
Connected Component: To find out all pixel which are connected with a initial known value.
⮚ Similar way like boundary filling algorithm
Mathematically be written as X[k] = (X[k-1] ⊕ B) ∩ A where k=1,2,3,4…….
• Here X0 =p , Terminates at X[k] = = = X[k-1]

⮚ Mainly used to detect artifacts in images


⮚ Discontinuity of bones in X-ray images
Connected Component Extraction
Connected Component: Example
Connected Component Extraction
Connected Component Extraction
Connected Component Extraction
Connected Component Extraction
Connected Component Extraction
Connected Component: Example to check understanding

Consider the following image and structuring element. Then find out the connected component in the image.

1 1 1 0 0 0 0 1 1 1
1 0 1 0 0 0 0 1 1 1
1 1 1 0 0 1 1 1 1 1
1 1 0 0 0 1 1
1 1 0 0 1 1 1
1 0 1 1 0 0 1
0 0 1 1 1 1 1
Other algorithms

➢ Thinning
➢ Thickening
➢ Skeleton
➢ Pruning
Thinning
➢ To remove selected foreground pixels from binary images
➢ Reduces the area of shape from every side of the image
➢ It also an application of hit-or-miss transform
➢ It an iterative method
➢ Mathematically can derived as

• Thinning of a set A of foreground pixels by a structuring element B, can be defined in terms of the hit-or-miss
transform:

➢ Obtained by a sequence of operation


Thinning
➢ Thinning operation is calculated by
translating the origin of the structuring
element to each possible pixel position in
the image
➢ If the foreground and background pixels in
the structuring element exactly match
foreground and background pixels in the
image, then the image pixel underneath the
origin of the structuring element is set to
background (zero).
➢ Otherwise unchanged
Thickening
➢ Thickening is a morphological operation that is used to
grow selected regions of foreground pixels in binary
images

➢ The thickening operation is related to the hit-and-miss


transform and can be expressed quite simply in terms of
it. The thickening of an image I by a structuring element
J is:

➢ It is also Obtained by a sequence of operation like


thinning
Skeleton

 An important approach to representing the structural shape of a plane region is to


reduce it to a graph.
 This reduction may be accomplished by obtaining the skeleton of the region via a
thinning algorithm.
Skeleton
Skeleton
Skeleton
Skeleton
Pruning
Pruning
Pruning
➢ Eliminates the parasites form the images
➢ The unwanted branches are removed
➢ It also detects the skeleton of image and then thins the image
Work example

1 1 0 0 0 0 0 1 1 1 × ×
1 1 1 1 1 1 1 1 0 0 × 1 × 1 1 1 1
1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 × × 1 1
1 1 1 1 1 1 1 1 0 0
B1 B2 …………… B8
1 1 1 0 0 1 1 1 0 0

Thin: If kernel completely match – 0


If kernel not match – Unchanged

Thick: Completely match – 1


Not match - Unchanged
Image Segmentation
⁂ It is a stage of transition from image processing methods whose inputs and
outputs are images, in which the inputs are images but outputs are attributes
extracted from those images.
⁂ Segmentation refers to the process of partitioning an image into multiple
regions.
⁂ Used to locate –
1. Object
2. Boundaries
Image Segmentation
❖ Discontinuity
1. Isolated point
2. Line detection
3. Edge detection

❖ Similarity
1. Thresholding
2. Region growing
3. Region split
Image Segmentation
⁂ Point Detection
- Done using sharpening filters. (Laplacian kernel)
Image Segmentation
⁂ Point Detection
Image Segmentation
⁂ Line Detection
- We use 2nd order derivatives which result in a thinner line than first
derivative.
Image Segmentation
⁂ Line Detection
Image Segmentation
⁂ Edge Detection
- Used frequently for segmenting image based on abrupt changes in intensity
- Thicker lines : Robert-cross, Prewitt, Sobel Operators (First derivative)
- Thinner line : Laplacian(2nd Order)
- Maximum Edge strength in a predetermine directions : Kirsch Compass
- Canny Edge Detection
Image Segmentation
0 1 1 -1 -1 0
⁂ Edge Detection
-1 0 1 -1 0 1

-1 -1 0 0 1 1

Prewitt mask for diagonal edges

0 1 2 -2 -1 0

-1 0 1 -1 0 1

-2 -1 0 0 1 2

Sobel mask for diagonal edges

Better noise
suppression
Image Segmentation
Image Segmentation

0 -1 0 -1 -1 -1

-1 4 -1 -1 8 -1
Second order kernels (The Laplacian)
0 -1 0 -1 -1 -1
Canny Edge Detection

 Noise Reduction
 Gradient Calculation
 Non-Maximum Suppression
 Double Thresholding
 Hysteresis
Canny Edge Detection

 Noise Reduction
 Since edge detection is susceptible to noise in the image, first step is to remove the
noise.
Canny Edge Detection

 Gradient Calculation
 Smoothens image is filtered with a sobel kernel in both X and Y direction to get
derivatives.
Canny Edge Detection
 Non-Maximum Suppression
 The final image should have thin edges. Thus, we must perform non-maximum
suppression to thin out the edges.
 The algorithm goes through all the points on the gradient intensity matrix and finds the
pixels with the maximum value in the edge directions.
Canny Edge Detection
 Double Thresholding
 More than maxVal = edges,
less than minVal = not edges
Canny Edge Detection

 Hysteresis
 Connected with ‘sure-edges’ pixel is considered to be part of edges.
Image Segmentation of Gray Image
⁂ In bi-level thresholding, image is segmented into two different regions.
⁂ The pixels with gray values greater than a certain value T are classified as object pixels, and
the others with gray values lesser than T are classified as background pixels.
⁂ Gray scale image contains pixel value within 0 to 255.
Image Segmentation of Gray Image
WaterShed Algorithm
⁂ The watershed is a classical algorithm used for segmentation, for separating
different objects in an image.
WaterShed Algorithm
⁂ Watershed : A watershed is the area of the land that drains to a particular
points along a stream
WaterShed Algorithm

⁂ Three types of points


1. Regional Minima
2. Catchment basin or watershed
3. Divide lines or watershed line
WaterShed Algorithm
⁂ Objective is to find watershed lines.
⁂ The idea –
1. A hole in regional minima
2. From where water will rise at uniform rate
3. While rising , at some point the water from two region will meet which is
the watershed line.
Watershed Algorithm

⁂ Algorithm –
1. Start with pixels with lowest possible
values.
2. For each pixel intensity –
>> If there is adjacent pixel within one
region, add the pixel to that region.
>> Else if there is adjacent pixel which is
adjacent to more region, mark as boundary.
>> Else start new region
Watershed Algorithm

General Segmentation :
Watershed Algorithm

Watershed Segmentation :
THANK YOU

You might also like