morphological image processing (chapter 9)

29
Morphological Image Processing (Chapter 9) CSC 446 Lecturer: Nada ALZaben

Upload: arvin

Post on 16-Feb-2016

104 views

Category:

Documents


2 download

DESCRIPTION

Morphological Image Processing (Chapter 9). CSC 446 Lecturer: Nada ALZaben. Outline: . Introduction. Some basic Concepts from Set theory Logic operations involving Binary Images. Dilation and Erosion Open and Close Processing gray scale images . The Hit-and-Miss transformation. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Morphological Image Processing (Chapter 9)

Morphological Image Processing(Chapter 9)

CSC 446 Lecturer: Nada ALZaben

Page 2: Morphological Image Processing (Chapter 9)

Outline : Introduction. Some basic Concepts from Set theory Logic operations involving Binary

Images. Dilation and Erosion Open and Close Processing gray scale images. The Hit-and-Miss transformation

Page 3: Morphological Image Processing (Chapter 9)

IntroductionThe word morphology commonly

denotes a branch of biology that deals with the form and structure of animals and plants.

Mathematical morphology is a tool that extract image components that are useful in the representation and discription of region shape such as:BoundariesSkeletonsConvex hull .

Sets in mathematical morphology represent objects in an image.

Page 4: Morphological Image Processing (Chapter 9)

Some basic Concepts from Set theory

Let A be set in . If a= is an element of A then we write:

if not we say Empty set is called null set and denoted by Sets are specified by the contents of two braces

{}.Elements of the sets in this chapter are the pixel

coordinates of representing objects in an image. Example:- when we write we mean that set C is the set of elements w such that w is formed by multiplying each of the two coordinates of all the elements of set D by -1.

Page 5: Morphological Image Processing (Chapter 9)

Some basic Concepts from Set theory.. (cont.) if every elements A is also an element of

another set B then A is subset of B, .Union of sets take all elements of A and B is .Intersection of two sets A and B is set of

elements belonging to both A and B , .Two sets are disjoint or mutually exclusive if

they have no common elements The complement of a set A is the set of

element not contained in A. } The difference of two sets A and B is , w

B}=

Page 6: Morphological Image Processing (Chapter 9)

Some basic Concepts from Set theory.. (cont.) The reflection of set B is is defined

as

The translation of set A by point z=( ), is defined as

Example.

Page 7: Morphological Image Processing (Chapter 9)

Logic Operation Involving Binary Images .Mostly used images are the binary

images.The principle logic operations used in

image processing are AND, OR and NOT

Logic operations are operated on a pixel by pixel basis between 2 images ,but, (NOT) operation use one image.

Page 8: Morphological Image Processing (Chapter 9)

Logic Operation Involving Binary Images .More operations:XOR: when only 1 in a pixel or the

other pixel is 1 but not both.NOT-AND: select the black pixel that

simultaneously are in B but not in A.NOTE:

Intersection ==ANDUnion ==ORComplement ==NOT

Page 9: Morphological Image Processing (Chapter 9)

Logic Operation Involving Binary Images .

Page 10: Morphological Image Processing (Chapter 9)

Logic Operation Involving Binary Images .

Note: -In binary images white will represent the foreground (1) while black is the background (0). -The set of coordinate to the image is simply the set of 2D Euclidean coordinates of al the foreground pixels in the image as the origin normally takes in one of the corners.

Page 11: Morphological Image Processing (Chapter 9)

Logic Operation Involving Binary Images .

Page 12: Morphological Image Processing (Chapter 9)

Dilation and Erosion Dilation is a morphological transformation

which essentially expands an object by adding a layer of pixels around it’s edges and as a result it shrinks any hole in the object.

With A and B as sets in the Dilation of A by B denoted as:

This equation means get the reflection of B about its origin and shifting this reflection by z. the dilation of A by B then is a set of all displacements z such that and A overlap by at least one element.

B usually called structuring element (kernal).

Page 13: Morphological Image Processing (Chapter 9)

Dilation and Erosion

Dilation advantage in bridges gaps in an image.

Page 14: Morphological Image Processing (Chapter 9)

Dilation Algorithm:Consider each of the background

pixels in the input image as input.For each background pixel we put

the structure element on top of the image so that the origin of the structure element coincides with the input image.

If at least one pixel in the structure element coincides with the foreground pixel in the image underneath then the input pixel is set to the foreground , otherwise leave it as it background value.

Page 15: Morphological Image Processing (Chapter 9)

Dilation and Erosion 1 1 11 1 11 1 1

Dilation example

Page 16: Morphological Image Processing (Chapter 9)

Dilation and Erosion Erosion is a morphological dual to

dilation which essentially shrinks an object by removing a layer of pixels around it’s edges and as a result it expands any hole in the object.

With A and B as sets in the Erosion of A by B denoted as:

Meaning the erosion of A by B then is a set of all points z such that translated by z is contained in A.

Page 17: Morphological Image Processing (Chapter 9)

Dilation and Erosion

Erosion advantage in eliminating irrelevant details in term of size in an image.

Note: if the structure element is larger than the object then the object will be eliminated completely

Page 18: Morphological Image Processing (Chapter 9)

Erosion algorithm:Consider each of the foreground

pixels in the input image as input.For each foreground pixel we put the

structure element on top of the image so that the origin of the structure element coincides with the input image.

If for every pixel in the structure element the corresponding pixel in image underneath is a foreground pixel then the input pixel is left as foreground , otherwise set it to background value.

Page 19: Morphological Image Processing (Chapter 9)

Dilation and Erosion

Page 20: Morphological Image Processing (Chapter 9)

Opening and Closing Now we know that Erosion shrinks an

object while Dilation expands it.By combining these operations we get

Open or Close operation.Open: Erosion then Dilation Close: Dilation then Erosion.

Opening and closing smothes the contour of an object but:Opening: breaks narrow lines and

eliminates thin protrusions( do thickening) Closing: focus on thin protrusions so it

eliminates small holes and fill gaps.

Page 21: Morphological Image Processing (Chapter 9)

Opening and Closing Opening:Closing: ex:

Close

Open

Page 22: Morphological Image Processing (Chapter 9)

Opening and Closing Perform open transformation on

image 1 and closing on image 2 where B is 1?

Open by 1

Close by 1

Page 23: Morphological Image Processing (Chapter 9)

Processing gray scale imagesSame methods can be applied to gray

scale images just little modification. Grayscale erode: output at a point is

minimum of image pixel and structuring element pixel.

Grayscale dilate: output is maximum of image and structuring element.

Page 24: Morphological Image Processing (Chapter 9)

Processing gray scale images

0 0 0 0 0 0 0 00 0 3 5 5 3 0 00 0 5 9 9 5 0 00 0 3 5 5 3 0 00 0 0 0 0 0 0 0

1 11 1

1 1 1 1 1 1 1 11 1 4 6 6 6 4 11 1 6 1

010

10

6 1

1 1 6 10

10

10

6 1

1 1 4 6 6 6 4 1

-1

-1

-1

-1

-1

-1

-1

-1

-1 -1 2 4 2 -1 -1 -1-1 -1 2 4 2 -1 -1 -1-1 -1 -1 -1 -1 -1 -1 -1-1 -1 -1 -1 -1 -1 -1 -1

Initial image

Dilation results Erosion results

The structuring element

Page 25: Morphological Image Processing (Chapter 9)

The Hit-and-Miss transformThe hit-and-miss transform is a general

binary morphological operation that can be used to look for particular patterns of foreground and background pixels in an image. A⊛B

It is actually the basic operation of binary morphology since almost all the other binary morphology operators can be derived from it.

As with other binary morphology operators it takes as input a binary image and a structuring element and produce another binary image as output.

Page 26: Morphological Image Processing (Chapter 9)

The Hit-and-Miss transformThe structure element contain both

1 and 0The operation is done as:

translating the structure image over all points in the image then by comparing the structure element 1’s and 0’s with image if they match then set the underlying pixel to foreground otherwise set as background.

Example of structure element

X 1 X0 1 10 0 X

Page 27: Morphological Image Processing (Chapter 9)

The Hit-and-Miss transformEx: assume the origin is at the

center of 3X3 structure element. In order to find all corners in an image we need to run hit and miss four times with four different structure element.

After obtaining the locations of corners we then simply OR all these images together to get the final result.

X 0 01 1 0x 1 X

0 0 X0 1 1x 1 X

X 1 X1 1 0x 0 0

X 1 X0 1 10 0 X

Page 28: Morphological Image Processing (Chapter 9)

The Hit-and-Miss transform0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 00 0 1 1 1 1 0 0 0 00 0 1 1 1 1 0 0 0 00 0 1 1 1 1 0 0 0 00 0 1 1 1 1 1 1 1 00 0 1 1 0 0 0 0 1 00 0 0 1 0 0 0 0 1 00 0 0 1 1 1 1 1 1 00 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 00 0 1 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 00 0 0 0 0 0 0 0 0 0

0 0 X0 1 1x 1 X

Exercise: do the rest and find the result..

Page 29: Morphological Image Processing (Chapter 9)

Exercise :How can the hit and miss transform

be used to perform erosion? How can the hit and miss transform

be used with the not operation to perform dilation?

What is the smallest number of different structuring elements that you would need to use to locate all foreground points in an image where they have at least one neighbor using the hit and miss transform? What do they look like?