ee 4780 morphological image processing. bahadir k. gunturk2 example two semiconductor wafer images...

50
EE 4780 Morphological Image Processing

Upload: gerald-booker

Post on 18-Jan-2018

222 views

Category:

Documents


0 download

DESCRIPTION

Bahadir K. Gunturk3 Example

TRANSCRIPT

Page 1: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

EE 4780

Morphological Image Processing

Page 2: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 2

Example

Two semiconductor wafer images are given. You are supposed to determine the defects based on these images.

Page 3: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 3

Example

Page 4: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 4

Example

Absolute value of the difference

Page 5: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 5

Example

>> b = zeros(size(a));>> b(a>100) = 1;>> figure; imshow(b,[ ]);

Page 6: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 6

Example

>> c = imerode(b,ones(3,3));>> figure; imshow(c,[]);

Page 7: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 7

Example

>> d = imdilate(c,ones(3,3));>> figure; imshow(d,[]);

Page 8: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 8

Mathematical Morphology We defined an image as a two-dimensional function, f(x,y),

of discrete (or real) coordinate variables, (x,y). An alternative definition of an image can be based on the

notion that an image consists of a set of discrete (or continuous) coordinates.

Page 9: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 9

Morphology

B = {(0,0), (0,1), (1,0)} A = {(5,0), (3,1), (4,1), (5,1), (3,2), (4,2), (5,2)}

A binary image containing two object sets A and B

Page 10: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 10

Morphology Sets in morphology represent the shapes of objects in an

image. For example, the set A = {(a1,a2)} represents a point in a

binary image. The set of all black pixels in a binary image is a complete

description of the image.

Page 11: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 11

Mathematical Morphology Morphology is a tool for extracting and processing image

components based on shapes. Morphological techniques include filtering, thinning,

pruning.

Page 12: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 12

Basic Set Operations

Page 13: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 13

Some Basic Definitions Let A and B be sets with components a=(a1,a2) and

b=(b1,b2), respectively. The translation of A by x=(x1,x2) is

A + x = {c | c = a + x, for a A} The reflection of A is

Ar = {x | x = -a for a A} The complement of A is

Ac = {x | x A} The union of A and B is

A B = {x | x A or x B } The intersection of A and B is

A B = {x | x A and x B }

Page 14: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 14

Some Basic Definitions The difference of A and B is.

A – B = A Bc = {x | x A and x B} A and B are said to be disjoint or mutually exclusive if they

have no common elements. If every element of a set A is also an element of another

set B, then A is said to be a subset of B.

Page 15: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 15

Some Basic Definitions Dilation

A B = {x | (B + x) A } Dilation expands a region.

Page 16: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 16

Some Basic Definitions

Page 17: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 17

Some Basic Definitions

Page 18: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 18

Some Basic Definitions Erosion

A B = {x | (B + x) A} Erosion shrinks a region.

Page 19: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 19

Some Basic Definitions

Page 20: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 21

Some Basic Definitions Opening is erosion followed by dilation:

A B = (A B) B Opening smoothes regions, removes spurs, breaks narrow

lines.

Page 21: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 22

Some Basic Definitions

Page 22: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 23

Some Basic Definitions Closing is dilation followed by erosion:

A B = (A B) B Closing fills narrow gaps and holes in a region.

Page 23: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 24

Some Basic Definitions

Page 24: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 25

Some Basic Definitions

Page 25: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 26

Some Morphological Algorithms

Opening followed by closing can eliminate noise:(A B) B

Page 26: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 27

Some Morphological Algorithms

Page 27: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 28

Some Morphological Algorithms

Boundary of a set, A, can be found byA - (A B)

B

Page 28: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 29

Some Morphological Algorithms

A region can be filled iteratively byXk+1 = (Xk B) Ac ,

where k = 0,1,… and X0 is a point inside the region.

Page 29: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 30

Some Morphological Algorithms

Page 30: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 31

Morphological Operations

BWMORPH Perform morphological operations on binary image. BW2 = BWMORPH(BW1,OPERATION) applies a specific morphological operation to the binary image BW1. BW2 = BWMORPH(BW1,OPERATION,N) applies the operation N times. N can be Inf, in which case the operation is repeated until the image no longer changes.

OPERATION is a string that can have one of these values: 'skel' With N = Inf, remove pixels on the boundaries of objects without allowing objects to break apart 'spur' Remove end points of lines without removing small objects completely. 'fill' Fill isolated interior pixels (0's surrounded by 1's) ...

Page 31: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 32

Morphological OperationsBW1 = imread('circbw.tif'); BW2 = bwmorph(BW1,'skel',Inf); imshow(BW1);figure, imshow(BW2);

Page 32: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 33

Morphological OperationsBW1 = imread('circbw.tif'); BW2 = bwperim(BW1); imshow(BW1); figure, imshow(BW2)

Page 33: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 34

Morphological OperationsPixel Connectivity Connectivity defines which pixels are connected to other pixels. A set of pixels in a binary image that form a connected group is called an object or a connected component.

4-connected 8-connected

Page 34: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 35

Morphological Operations

X = bwlabel(BW,4); RGB = label2rgb(X, @jet, 'k'); imshow(RGB,'notruesize')

BW = [0 0 0 0 0 0 0 0; 0 1 1 0 0 1 1 1; 0 1 1 0 0 0 1 1; 0 1 1 0 0 0 0 0; 0 0 0 1 1 0 0 0; 0 0 0 1 1 0 0 0; 0 0 0 1 1 0 0 0; 0 0 0 0 0 0 0 0]; X = bwlabel(BW,4) X = 0 0 0 0 0 0 0 0 0 1 1 0 0 3 3 3 0 1 1 0 0 0 3 3 0 1 1 0 0 0 0 0 0 0 0 2 2 0 0 0 0 0 0 2 2 0 0 0 0 0 0 2 2 0 0 0 0 0 0 0 0 0 0 0

Page 35: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 36

Some Morphological Algorithms

Application example: Using connected components to detect foreign objects in packaged food.There are four objects with significant size!

Page 36: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 37

Some Morphological Algorithms

Thinning: Thin regions iteratively; retain connections and endpoints.

Skeletons: Reduces regions to lines of one pixel thick; preserves shape.

Convex hull: Follows outline of a region except for concavities.

Pruning: Removes small branches.

Page 37: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 38

Summary

Page 38: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 39

Summary

Page 39: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 40

Summary

Page 40: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 41

Summary

Page 41: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 42

Extensions to Gray-Scale ImagesDilation

Page 42: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 43

Extensions to Gray-Scale ImagesDilation

Take the maximum within the window.

Page 43: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 44

Extensions to Gray-Scale ImagesErosion

Page 44: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 45

Extensions to Gray-Scale Images

Dilation: Makes image brighter Reduces or eliminates dark details

Erosion: Makes image darker Reduces or eliminates bright details

Page 45: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 46

Extensions to Gray-Scale Images

Page 46: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 47

Extensions to Gray-Scale Images

Opening: Narrow bright areas are reduced.Closing: Narrow dark areas are reduced.

Page 47: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 49

Extensions to Gray-Scale Images

Page 48: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 50

Application Example

Page 49: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 51

Application Example-Segmentation

Page 50: EE 4780 Morphological Image Processing. Bahadir K. Gunturk2 Example Two semiconductor wafer images are given. You are supposed to determine the defects

Bahadir K. Gunturk 52

Application Example-Granulometry