Einfhrung in Visual Computing Unit 18: Morphological Operations - - PowerPoint PPT Presentation

einf hrung in visual computing
SMART_READER_LITE
LIVE PREVIEW

Einfhrung in Visual Computing Unit 18: Morphological Operations - - PowerPoint PPT Presentation

Einfhrung in Visual Computing Unit 18: Morphological Operations http:// www.caa.tuwien.ac.at/cvl/teaching/sommersemester/evc Content: Introduction Structuring Element Erosion Dilation Opening Closing Hit and


slide-1
SLIDE 1

Einführung in Visual Computing

Unit 18: Morphological Operations

  • Content:
  • Introduction
  • Structuring Element
  • Erosion
  • Dilation
  • Opening
  • Closing
  • Hit‐and‐Miss
  • Thinning

http://www.caa.tuwien.ac.at/cvl/teaching/sommersemester/evc

1 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-2
SLIDE 2

Introduction

  • Morphology denotes branch of biology that deals with form and

structure of animals and plants.

  • Same word in the context of Mathematical Morphology: Tool for

extracting image components that are useful in representation and description of region shape, such as boundaries, skeletons etc.

  • Language of Mathematical Morphology is set theory.
  • Sets in Mathematical Morphology represent objects in image.
  • Motive: Extract features from shape

2 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-3
SLIDE 3

Introduction

  • Morph means “Shape”
  • We do Morphology for

Shape Analysis & Shape Study.

  • Shape analysis easy in case of binary images, pixel locations

describe the shape.

  • Digital Morphology is a way to describe or analyze the shape of
  • bjects in digital images

3 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-4
SLIDE 4

Introduction

  • Value of each pixel in the output image is based on a comparison
  • f the corresponding pixel in the input image with its neighbors.
  • By choosing size and shape of neighborhood, you can construct a

morphological operation that is sensitive to specific shapes in the input image.

  • Morphologic operations are especially suited to the processing of

binary and greyscale images.

  • Good for, e.g.,
  • Noise removal in background
  • Removal of holes in foreground / background

4 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-5
SLIDE 5

Basic Concepts From Set Theory

       

. B x and A x | x B A B, and A

  • f

difference The . A x | x A A,

  • f

complement The . B x and A x | x B A B, and A

  • f
  • n

intersecti The . B

  • r x

A x | x B A B, and A

  • f

union The . B a A, a every for if B, A written B,

  • f

subset a is A A. a A write

  • f

element an not is a indicate To A. a A write

  • f

element an is a indicate To sets. be B and A Let

c

                  

5 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-6
SLIDE 6

A B A B B A A B

B A  B A 

c

A

c

B A B A   

A

Examples

6 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-7
SLIDE 7

Dilation and Erosion

  • Dilation and Erosion are the two fundamental morphological
  • perations.
  • Dilation adds pixels to the boundaries of objects in an image,

while erosion removes pixels on object boundaries.

  • In morphological dilation and erosion operations, the state of any

given pixel in the output image is determined by applying a rule to the corresponding pixel and its neighbors in the input image.

  • The rule used to process the pixels defines the operation as

Dilation or Erosion.

7 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-8
SLIDE 8

A first Example: Erosion

  • Erosion is an important morphological operation
  • Applied Structuring Element:

8 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-9
SLIDE 9

Example for Erosion

1 1 1 1 1 1

Input image Structuring Element Output Image

1 1 1

9 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-10
SLIDE 10

Example for Erosion

1 1 1 1 1 1 1 1 1

Input image Structuring Element Output Image

10 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-11
SLIDE 11

Example for Erosion

1 1 1 1 1 1 1 1 1

Input image Structuring Element Output Image

11 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-12
SLIDE 12

Example for Erosion

1 1 1 1 1 1 1 1 1

Input image Structuring Element Output Image

12 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-13
SLIDE 13

Example for Erosion

1 1 1 1 1 1 1 1 1 1

Input image Structuring Element Output Image

13 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-14
SLIDE 14

Example for Erosion

1 1 1 1 1 1 1 1 1 1

Input image Structuring Element Output Image

14 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-15
SLIDE 15

Example for Erosion

1 1 1 1 1 1 1 1 1 1

Input image Structuring Element Output Image

15 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-16
SLIDE 16

Example for Erosion

1 1 1 1 1 1 1 1 1 1

Input image Structuring Element Output Image

16 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-17
SLIDE 17

Dilation & Erosion

  • Basic operations
  • Are dual to each other:
  • Erosion shrinks foreground,

enlarges Background

  • Dilation enlarges foreground,

shrinks background

17 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-18
SLIDE 18

Structuring Element

slide-19
SLIDE 19

Structuring Element

  • Essential part of morphological operations

is the Structuring Element used to probe the input image.

  • Two‐dimensional structuring elements

consist of a matrix of 0’s and 1’s, much smaller than the image being processed.

  • Structuring Elements can have varying

sizes

  • Element values are 0,1 and none (!)
  • Structural Elements have origin (anchor

pixel)

19 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-20
SLIDE 20

Structuring Elements

  • The center pixel of the structuring element, called the origin,

identifies the pixel of interest—the pixel being processed.

  • The pixels in the structuring element containing 1’s define the

neighborhood of the structuring element.

20 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-21
SLIDE 21

Example of Structuring Elements (Kernels)

  • Empty spots in the Structuring Elements are don’t care’s!

Box Disc

21 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-22
SLIDE 22

Erosion

slide-23
SLIDE 23

Erosion

  • Erosion is the set of all points in the image, where the structuring

element “fits into”.

  • Consider each foreground pixel in the input image
  • If the structuring element fits in, write a “1” at the origin of the

structuring element!

  • Simple application of pattern matching
  • Input:
  • Binary Image (Gray value)
  • Structuring Element, containing only 1s!

23 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-24
SLIDE 24

Erosion

  • Brief Description
  • To delete or to reduce something
  • Pixels matching a given pattern are deleted from the image.
  • Basic effect

Erode away the boundaries of regions of foreground pixels (i.e. white pixels, typically).

Common names: Erode, Shrink, Reduce

24 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-25
SLIDE 25

Erosion

  • How It Works
  • A & B are sets in Z², the erosion of A by B, denoted as
  • In words, this equation indicates that the erosion of A by B is the

set of all points z such that B, translated by z, is contained in A.

B A

A B z B A

z 

  ) (

25 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-26
SLIDE 26

Erosion

Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations 26

A 3×3 square structuring element

Set of coordinate points = { (‐1, ‐1), (0, ‐1), (1, ‐1), (‐1, 0), (0, 0), (1, 0), (‐1, 1), (0, 1), (1, 1) }

Effect of erosion using a 3×3 square structuring element

slide-27
SLIDE 27

Erosion

  • Erosion By a Rectangular Structuring Element

A B

B A

27 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-28
SLIDE 28

Another Example of Erosion

  • White = 0, black = 1, dual property, image as a result of erosion

gets darker

28 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-29
SLIDE 29

Matlab Programming: Erosion

%Read image I = imread(‘ford.tiff'); figure('Name', 'original'); imshow(I); %create structuring elements % 11‐by‐11 square se1 = strel('square',11); %Apply erosion operation figure('Name', 'Erode'); Ierode1 = imerode(I,se1); %Show the result image subplot(1,1,1), imshow(Ierode1), title('11x11 square');

29 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-30
SLIDE 30

Iterative Operation of Erosion

Original Image after 1 erosion after 5 erosions after inf erosions

30 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-31
SLIDE 31

Counting Coins

  • Counting coins is difficult because they touch each other!
  • Solution: Binarization and Erosion separates them!

31 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-32
SLIDE 32

Dilation

slide-33
SLIDE 33

Dilation

  • Dilation is the set of all points in the image, where the

structuring element “touches” the foreground.

  • Consider each pixel in the input image
  • If the structuring element touches the foreground image,

write a “1” at the origin of the structuring element!

  • Input:
  • Binary Image
  • Structuring Element, containing only 1s!!

33 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-34
SLIDE 34

Dilation

  • Brief Description
  • To expand or to increase something.
  • Basic effect: Gradually enlarge the boundaries of regions of

foreground pixels on a binary image.

Common names: Dilate, Grow, Expand

34 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-35
SLIDE 35

Dilation

  • How It Works:
  • A & B are sets in Z², the dilation of A by B, denoted as
  • This equation is based on obtaining the reflection of B about its
  • rigin and shifting this reflection by z.
  • The dilation of A by B is the set of all displacements z, such that B

and A overlap by at least one element. Based on this interpretation the equation can be written as:

B A

A A B z B A

z

    ) (

35 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-36
SLIDE 36

Dilation

Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations 36

Effect of dilation using a 3×3 square structuring element 3×3 square structuring element

Set of coordinate points = { (‐1, ‐1), (0, ‐1), (1, ‐1), (‐1, 0), (0, 0), (1, 0), (‐1, 1), (0, 1), (1, 1) }

slide-37
SLIDE 37

Example for Dilation

1 1 1 1 1 1 1 1 1 1

Input image Structuring Element Output Image

37 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-38
SLIDE 38

Example for Dilation

1 1 1 1 1 1 1 1 1 1

Input image Structuring Element Output Image

38 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-39
SLIDE 39

Example for Dilation

1 1 1 1 1 1 1 1 1 1 1

Input image Structuring Element Output Image

39 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-40
SLIDE 40

Example for Dilation

1 1 1 1 1 1 1 1 1 1 1 1

Input image Structuring Element Output Image

40 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-41
SLIDE 41

Example for Dilation

1 1 1 1 1 1 1 1 1 1 1 1 1

Input image Structuring Element Output Image

41 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-42
SLIDE 42

Example for Dilation

1 1 1 1 1 1 1 1 1 1 1 1 1 1

Input image Structuring Element Output Image

42 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-43
SLIDE 43

Example for Dilation

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Input image Structuring Element Output Image

43 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-44
SLIDE 44

Example for Dilation

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Input image Structuring Element Output Image

44 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-45
SLIDE 45

Dilation

  • Example: Binary dilation (Region Filling)
  • Dilation is also used as the basis for other mathematical

morphology operators, often in combination with logical

  • perators.
  • Region filling is a morphological algorithm

Original image Region filling

45 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-46
SLIDE 46

Another Dilation Example

  • Image get lighter, more uniform intensity

46 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-47
SLIDE 47

Matlab Programming: Dilation

%Read image I = imread(‘ford.tiff'); figure('Name', 'original'); imshow(I); %create structuring elements % 11‐by‐11 square se1 = strel('square',11); %Apply dilation operation figure('Name', 'Dilate'); Idilate1 = imdilate(I,se1); %Show the result image subplot(1,1,1), imshow(Idilate1), title('11x11 square');

47 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-48
SLIDE 48

Iterative Operation of Dilation

Original Image after 1 dilation after 5 dilations after inf dilations

48 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-49
SLIDE 49

Dilation

  • Dilation By A Rectangular Structuring Element

Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations 49

A A

B A

B

slide-50
SLIDE 50

Edge Detection

  • Edge Detection

1.

Dilate input image

2.

Subtract input image from dilated image

3.

Edges remain!

50 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-51
SLIDE 51

Opening

slide-52
SLIDE 52

Opening & Closing

  • Important operations
  • Derived from the fundamental operations
  • Dilation
  • Erosion
  • Usually applied to binary images, but gray value images are also

possible

  • Opening and closing are dual operations

52 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-53
SLIDE 53

Combining Dilation and Erosion

  • Morphological Opening
  • Opening is defined as an erosion, followed by a dilation.
  • Morphological Closing
  • Closing is defined as a dilation, followed by an erosion.

53 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-54
SLIDE 54

Opening

  • Similar to Erosion
  • Spot and noise removal
  • Less destructive
  • Erosion next Dilation
  • Same structuring element for both operations.
  • Input:
  • Binary Image
  • Structuring Element, containing only 1s!

54 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-55
SLIDE 55

Opening

  • Take the structuring element and slide it around inside each

foreground region.

  • All pixels which can be covered by the SE with the SE being

entirely within the foreground region will be preserved.

  • All foreground pixels which can not be reached by the

structuring element without lapping over the edge of the foreground object will be eroded away!

  • Opening is idempotent: Repeated application has no further

effects!

55 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-56
SLIDE 56

Opening

  • Brief Description
  • Opening tends to “open” small gaps or spaces between

touching objects in an image.

  • Opening is also used to remove noise (Pepper noise).
  • The erosion step in an opening will remove isolated pixels as

well as boundaries of object and the dilation step will restore most of the boundary pixels without restoring the noise.

Common names: Opening

56 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-57
SLIDE 57

Opening

  • How It works
  • Opening is defined as an erosion followed by a dilation.
  • Opening is the dual of closing
  • Opening the foreground pixels with a particular structuring

element is equivalent to Closing the background pixels with the same element.

 

B B A B A    

57 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-58
SLIDE 58

Opening

  • Structuring element: 3x3 square

1 1 1 1 1 1 1 1 1

58 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-59
SLIDE 59

Opening

  • Binary Opening Example
  • Separate out the circles from the lines
  • The lines have been almost completely removed while the circles

remain almost completely unaffected.

A mixture of circle and lines Opening with a disk shaped structuring element with 11 pixels in diameter

59 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-60
SLIDE 60

Opening Example

  • Opening with a 9 pixel diameter disc

Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations 60

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

slide-61
SLIDE 61

Opening Example

  • 3x9 and 9x3 Structuring Element

3*9 9*3

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

61 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-62
SLIDE 62

Opening

  • Binary Opening Example
  • Extract the horizontal and vertical lines separately
  • There are a few glitches in rightmost image where the diagonal

lines cross vertical lines.

  • These could easily be eliminated, however, using a slightly longer

structuring element.

Original image

The result of an Opening with 3×9 vertically oriented structuring element The result of an Opening with 9×3 horizontally oriented structuring element

62 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-63
SLIDE 63

Matlab Programming: Opening

%Read image I = imread(‘ford.tiff'); figure('Name', 'original'); imshow(I); %create structuring elements % 11‐by‐11 square se1 = strel('square',11); %Apply the open opration figure('Name', 'Open'); Iopen1 = imopen(I,se1); %Show the result image subplot(1,1,1), imshow(Iopen1), title('11x11 square');

63 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-64
SLIDE 64

Iterative Operation of Opening

Original Image after 1 opening after 5 openings after inf openings

64 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-65
SLIDE 65

Use Opening for Separating Blobs

  • Use large structuring element that fits into the big blobs
  • Structuring Element: 11 pixel disc

65 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-66
SLIDE 66

Closing

slide-67
SLIDE 67

Closing

  • Similar to Dilation
  • Removal of holes
  • Tends to enlarge regions, shrink background
  • Closing is defined as a Dilatation, followed by an Erosion using the

same structuring element for both operations.

  • Dilation next Erosion!
  • Input:
  • Binary Image
  • Structuring Element, containing only 1s!

67 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-68
SLIDE 68

Closing

  • Take the structuring element and slide it around outside each

foreground region.

  • All background pixels which can be covered by the SE with the

SE being entirely within the background region will be preserved.

  • All background pixels which can not be reached by the

structuring element without lapping over the edge of the foreground object will be turned into a foreground.

  • Opening is idempotent: Repeated application has no further

effects!

68 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-69
SLIDE 69

Closing

  • Structuring element: 3x3 square

1 1 1 1 1 1 1 1 1

69 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-70
SLIDE 70

Closing Example

  • Closing operation with a 22 pixel disc
  • Closes small holes in the foreground

70 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-71
SLIDE 71
  • Threshold
  • Closing with disc of size 20

Closing Example

Thresholded closed

71 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-72
SLIDE 72

Matlab Programming: Closing

%Read image I = imread(‘ford.tiff'); figure('Name', 'original'); imshow(I); %create structuring elements % 11‐by‐11 square se1 = strel('square',11); %Apply close operation figure('Name', ‘Close'); Iclose1 = imclose(I,se1); %Show the result image subplot(1,1,1), imshow(Iclose1), title('11x11 square');

Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations 72

slide-73
SLIDE 73

Iterative Operation of Closing

Original Image after 1 opening after 5 openings after inf openings

73 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-74
SLIDE 74

Opening & Closing

  • Opening is the dual of closing
  • i.e. opening the foreground pixels with a particular structuring

element

  • is equivalent to closing the background pixels with the same

element.

74 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-75
SLIDE 75

Hit and Miss

slide-76
SLIDE 76

Hit‐and‐Miss Transform

  • Used to look for particular patterns of foreground and

background pixels

  • Very simple object recognition
  • All other morphological operations can be derived from it!!
  • Input:
  • Binary Image
  • Structuring Element, containing 0s and 1s!!

76 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-77
SLIDE 77

Hit‐and‐Miss Transform

  • How It Works
  • The structuring element used in the hit‐and‐miss can contain both

foreground and background pixels.

  • Operations

If the foreground and background pixels in the structuring element exactly match foreground and background pixels in the image, then the pixel underneath the origin of the structuring element is set to the foreground color. If it doesn't match, then that pixel is set to the background color.

77 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-78
SLIDE 78

Hit‐and‐Miss Transform

  • Effect of the hit‐and‐miss based right angle convex corner

detector

Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations 78

Four structuring elements used for corner finding in binary images

slide-79
SLIDE 79

Hit‐and‐Miss Transform

  • Guidelines for Use
  • The hit‐and‐miss transform is used to look for occurrences of

particular binary patterns.

  • It can be used to look for several patterns: Simply by running

successive transforms using different structuring elements, and then ORing the results together.

  • The operations of erosion, dilation, opening, closing, thinning

and thickening can all be derived from the hit‐and‐miss transform in conjunction with simple set operations.

79 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-80
SLIDE 80

Hit‐and‐Miss Transform

Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations 80

  • The triple points (points where three lines meet) of the skeleton
  • Hit‐and‐miss transform outputs single foreground pixels at each triple

point

  • Image was dilated once using a cross‐shaped structuring element in
  • rder to mark these isolated points clearly, and this was then ORed

with the original skeleton.

slide-81
SLIDE 81

Basic Thinning

slide-82
SLIDE 82

Thinning

1.

Used to remove selected foreground pixels from binary images

2.

After edge detection, lines are often thicker than one pixel.

3.

Thinning can be used to thin those line to one pixel width.

82 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-83
SLIDE 83

Thinning

  • Brief Description
  • Remove selected foreground pixels from binary images,

somewhat like erosion or opening.

  • Thinning is normally applied only to binary images.

Common names: Thinning

83 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-84
SLIDE 84

Thinning

  • Operation
  • Translate origin of the structuring element to each possible

pixel position in the image and compare it with the underlying image pixels.

  • If 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, it is left unchanged.

Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations 84

slide-85
SLIDE 85

Thinning

  • Example: Thinning (character recognition)
  • 1) shows the structuring element used in combination with

thinning to obtain the skeleton.

  • 2) was used in combination with thinning to prune the skeleton

and with the hit‐and‐miss operator to find the end points of the skeleton.

  • Each structuring element was used in each of its 45°rotations.

85 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-86
SLIDE 86

Thinning

A simple way to obtain the skeleton of the character is to thin the image until convergence. The line is broken at some locations, which might cause problems during the recognition process.

Original image Thresholded image Thinning result

86 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations

slide-87
SLIDE 87

Example Thinning

  • We use two Hit‐and‐miss Transforms

87 Robert Sablatnig, Computer Vision Lab, EVC‐18: Morphological Operations