1 of 58

�� �Morphological Image Processing����

Digital Image Processing

2 of 58

Remember

GRAY LEVEL THRESHOLDING

Objects

Set threshold here

3 of 58

BINARY IMAGE

Problem here

How do we fill “missing pixels”?

4 of 58

Mathematic Morphology

mathematical framework used for:

  • pre-processing
    • noise filtering, shape simplification, ...
  • enhancing object structure
    • skeletonization, convex hull...
  • Segmentation
    • watershed,…
  • quantitative description
    • area, perimeter, ...

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

5 of 58

Z2 and Z3

  • set in mathematic morphology represent objects in an image
    • binary image (0 = white, 1 = black) : the element of the set is the coordinates (x,y) of pixel belong to the object 🢧 Z2
  • gray-scaled image : the element of the set is the coordinates (x,y) of pixel belong to the object and the gray levels 🢧 Z3

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

6 of 58

Basic Set Theory

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

7 of 58

Reflection and Translation

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

8 of 58

Example

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

9 of 58

Structuring element (SE)

  • small set to probe the image under study
  • for each SE, define origo
  • shape and size must be adapted to geometric

properties for the objects

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

10 of 58

Examples: Structuring Elements

origin

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

11 of 58

Basic idea

  • in parallel for each pixel in binary image:
    • check if SE is ”satisfied”
    • output pixel is set to 0 or 1 depending on used operation

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

12 of 58

Example

Origin of B visits every element of A

At each location of the origin of B, if B is completely contained in A, then the location is a member of the new set, otherwise it is not a member of the new set.

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

13 of 58

Basic morphological operations

  • Erosion

  • Dilation

  • combine to
    • Opening object
    • Closening background

keep general shape but smooth with respect to

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

14 of 58

Erosion

  • Does the structuring element fit the set?

erosion of a set A by structuring element B: all z in A such that B is in A when origin of B=z

shrink the object

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

15 of 58

Erosion

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

16 of 58

Erosion

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

17 of 58

Erosion

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

18 of 58

Erosion

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

19 of 58

Dilation

  • Does the structuring element hit the set?
  • the dilation of A by B can be understood as the locus of the points covered by B when the center of B moves inside A.

  • grow the object

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

20 of 58

Dilation

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

21 of 58

Dilation

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

22 of 58

Dilation

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

23 of 58

Dilation

B = structuring element

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

24 of 58

Dilation : Bridging gaps

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

25 of 58

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

26 of 58

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

27 of 58

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

28 of 58

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

29 of 58

useful

  • erosion
    • removal of structures of certain shape and size, given by SE
  • Dilation
    • filling of holes of certain shape and size, given by SE

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

30 of 58

Combining erosion and dilation

  • WANTED:
    • remove structures / fill holes
    • without affecting remaining parts

  • SOLUTION:
  • combine erosion and dilation
  • (using same SE)

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

31 of 58

Erosion : eliminating irrelevant detail

structuring element B = 13x13 pixels of gray level 1

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

32 of 58

Opening

erosion followed by dilation, denoted ∘

  • eliminates protrusions
  • breaks necks
  • smoothes contour

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

33 of 58

Opening

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

34 of 58

Opening

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

35 of 58

Opening

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

36 of 58

Opening example

Opening with a 11 pixel diameter disc:

3x9 and 9x3 Structuring Element

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

37 of 58

Closing

dilation followed by erosion, denoted •

  • smooth contour
  • fuse narrow breaks and long thin gulfs
  • eliminate small holes
  • fill gaps in the contour

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

38 of 58

Closing

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

39 of 58

Closing

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

40 of 58

Closing

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

41 of 58

Another closing example

Closing operation with a 22 pixel disc, closes small holes in the foreground.

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

42 of 58

And another…

Threshold, closing with disc of size 20.

Note that 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.

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

43 of 58

Properties

Opening

  1. A°B is a subset (subimage) of A
  2. If C is a subset of D, then C °B is a subset of D °B
  3. (A °B) °B = A °B

Closing

  1. A is a subset (subimage) of A∙B
  2. If C is a subset of D, then C ∙B is a subset of D ∙B
  3. (A ∙B) ∙B = A ∙B

Note: repeated openings/closings has no effect!

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

44 of 58

Duality

  • Opening and closing are dual with respect to complementation and reflection

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

45 of 58

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

46 of 58

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

47 of 58

Useful: open & close

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

48 of 58

APPLICATIONS

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

49 of 58

Application: filtering

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

50 of 58

Hit-and-miss transform

  • Used to look for particular patterns of foreground and background pixels
  • Very simple object recognition
  • Example for a Hit-and-miss Structuring Element: Contains 0s, 1s and don’t care’s.
  • Similar to Pattern Matching:
  • If 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 colour.

*

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

51 of 58

Hit-and-miss example: corner detection

  • Structuring Elements representing four corners.
  • Apply each Structuring Element.
  • Use OR operation to combine the four results.

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

52 of 58

Boundary Extraction

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

53 of 58

Example

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

54 of 58

Region Filling

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

55 of 58

Region Filling Algorithm

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

56 of 58

Example

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

57 of 58

Thinning

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal

58 of 58

Thickening

  • The thickening operation is calculated by translating the origin of the structuring element to each possible pixel position in the image, and at each such position comparing it with the underlying image pixels. 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 foreground (one). Otherwise it is left unchanged. Note that the structuring element must always have a zero or a blank at its origin if it is to have any effect.

Alternatively, based on Thining

Pattern Recognition and Computer Vision, Dr. Apoorva Aggarwal