+ All Categories
Home > Documents > Image and Multidimensional Signal Processing - Inside...

Image and Multidimensional Signal Processing - Inside...

Date post: 16-Mar-2018
Category:
Upload: truongmien
View: 230 times
Download: 1 times
Share this document with a friend
20
Colorado School of Mines Department of Electrical Engineering and Computer Science Colorado School of Mines Department of Electrical Engineering and Computer Science Colorado School of Mines Image and Multidimensional Signal Processing Professor William Hoff Dept of Electrical Engineering &Computer Science http://inside.mines.edu/~whoff/
Transcript
Page 1: Image and Multidimensional Signal Processing - Inside …inside.mines.edu/~whoff/courses/EENG510/lectures/12-Morphological... · Image and Multidimensional Signal Processing Professor

Colorado School of Mines Department of Electrical Engineering and Computer Science Colorado School of Mines Department of Electrical Engineering and Computer Science

Colorado School of Mines

Image and Multidimensional Signal Processing

Professor William Hoff

Dept of Electrical Engineering &Computer Science

http://inside.mines.edu/~whoff/

Page 2: Image and Multidimensional Signal Processing - Inside …inside.mines.edu/~whoff/courses/EENG510/lectures/12-Morphological... · Image and Multidimensional Signal Processing Professor

Colorado School of Mines Department of Electrical Engineering and Computer Science

Morphological Image Algorithms

2

Page 3: Image and Multidimensional Signal Processing - Inside …inside.mines.edu/~whoff/courses/EENG510/lectures/12-Morphological... · Image and Multidimensional Signal Processing Professor

Colorado School of Mines Department of Electrical Engineering and Computer Science Colorado School of Mines Department of Electrical Engineering and Computer Science

Outline

• Morphological algorithms

– Boundary Extraction

– Hit or Miss Transform

– Region Filling

– Skeletonization

– Function “bwmorph” in Matlab

• Grayscale morphology

3

Page 4: Image and Multidimensional Signal Processing - Inside …inside.mines.edu/~whoff/courses/EENG510/lectures/12-Morphological... · Image and Multidimensional Signal Processing Professor

Colorado School of Mines Department of Electrical Engineering and Computer Science Colorado School of Mines Department of Electrical Engineering and Computer Science

Boundary Extraction

BAAA )(

• To find the boundary of a set A, erode

it by a small structuring element B

• Then take the set difference between A

and its erosion

• Example

BAA A BA

4

Page 5: Image and Multidimensional Signal Processing - Inside …inside.mines.edu/~whoff/courses/EENG510/lectures/12-Morphological... · Image and Multidimensional Signal Processing Professor

Colorado School of Mines Department of Electrical Engineering and Computer Science

Hit or Miss Transform

• A method to find the location of a shape B1 in an image A – Erosion of A Ө B1 gives all places where B1 fits in A

• But B1 fits in any sufficiently large shape

• So also require the boundary around the shape, B2 to be empty – Erosion of Ac Ө B2 gives all places where B2 fits in empty places

of A

• Then take intersection

21 BABABA c

5

Page 6: Image and Multidimensional Signal Processing - Inside …inside.mines.edu/~whoff/courses/EENG510/lectures/12-Morphological... · Image and Multidimensional Signal Processing Professor

Colorado School of Mines Department of Electrical Engineering and Computer Science Colorado School of Mines Department of Electrical Engineering and Computer Science

Question:

• Template matching using

cross correlation also finds

shapes.

• How is the hit-or-miss

transform different? 6

Page 7: Image and Multidimensional Signal Processing - Inside …inside.mines.edu/~whoff/courses/EENG510/lectures/12-Morphological... · Image and Multidimensional Signal Processing Professor

Colorado School of Mines Department of Electrical Engineering and Computer Science

Region Filling

• Let A be the set of 8-

connected boundary points of

a region

• Start with a point inside the

region

• Repeatedly dilate

• At each step, set to zero the

points corresponding to the

region boundary

• Stop when no more changes

,3,2,1,1 kABXX c

kk

7

Page 8: Image and Multidimensional Signal Processing - Inside …inside.mines.edu/~whoff/courses/EENG510/lectures/12-Morphological... · Image and Multidimensional Signal Processing Professor

Colorado School of Mines Department of Electrical Engineering and Computer Science Colorado School of Mines Department of Electrical Engineering and Computer Science

Skeletonization

• Is the set of all points that are equally distant from two closest points of the object boundary

• Equivalently, the union of all maximal disk centers that are contained in the object

• A concise representation of a shape

• Analogy – Start a fire at the boundary, let it burn inward

– Points where fire is quenched are the skeleton

Object can be

reconstructed as a

union of disks

8

Page 9: Image and Multidimensional Signal Processing - Inside …inside.mines.edu/~whoff/courses/EENG510/lectures/12-Morphological... · Image and Multidimensional Signal Processing Professor

Colorado School of Mines Department of Electrical Engineering and Computer Science Colorado School of Mines Department of Electrical Engineering and Computer Science

Matlab Example

• Use function bwmorph(BW, 'skel', Inf);

But results are

sensitive to small

perturbations in

the boundary

9

Page 10: Image and Multidimensional Signal Processing - Inside …inside.mines.edu/~whoff/courses/EENG510/lectures/12-Morphological... · Image and Multidimensional Signal Processing Professor

Colorado School of Mines Department of Electrical Engineering and Computer Science

Grayscale Morphology

• Instead of binary images, assume we

have gray values f(x,y), where x,y are

integer pixels

• Let b(x,y) be the gray level structuring

element

• We will only focus on flat (constant

value) structuring elements

b(x,y)

0 50 100 150 200 250 300 350 4000

50

100

150

200

250

Distance along profile

10

Page 11: Image and Multidimensional Signal Processing - Inside …inside.mines.edu/~whoff/courses/EENG510/lectures/12-Morphological... · Image and Multidimensional Signal Processing Professor

Colorado School of Mines Department of Electrical Engineering and Computer Science

Grayscale Morphology

),(max),(),(

tysxfyxbfbts

11

• Definition of dilation with flat structuring element

• Reflect b(s,t), slide it past f(x,y); at each position, take the maximum

of f(x,y) within the window of b(s,t)

b(s,t)

Page 12: Image and Multidimensional Signal Processing - Inside …inside.mines.edu/~whoff/courses/EENG510/lectures/12-Morphological... · Image and Multidimensional Signal Processing Professor

Colorado School of Mines Department of Electrical Engineering and Computer Science

Grayscale Morphology

),(max),(),(

tysxfyxbfbts

12

• Definition of dilation with flat structuring element

• Reflect b(s,t), slide it past f(x,y); at each position, take the maximum

of f(x,y) within the window of b(s,t)

b(s,t)

Page 13: Image and Multidimensional Signal Processing - Inside …inside.mines.edu/~whoff/courses/EENG510/lectures/12-Morphological... · Image and Multidimensional Signal Processing Professor

Colorado School of Mines Department of Electrical Engineering and Computer Science Colorado School of Mines Department of Electrical Engineering and Computer Science

• Definition of erosion (with flat SE)

• Slide b(s,t) past f(x,y); at each position, take the minimum of f(x,y)

within that window

Gray Scale Erosion

),(min),(),(

tysxfyxbfbts

13

b(s,t)

Page 14: Image and Multidimensional Signal Processing - Inside …inside.mines.edu/~whoff/courses/EENG510/lectures/12-Morphological... · Image and Multidimensional Signal Processing Professor

Colorado School of Mines Department of Electrical Engineering and Computer Science Colorado School of Mines Department of Electrical Engineering and Computer Science

• Definition of erosion (with flat SE)

• Slide b(s,t) past f(x,y); at each position, take the minimum of f(x,y)

within that window

Gray Scale Erosion

),(min),(),(

tysxfyxbfbts

14

b(s,t)

Page 15: Image and Multidimensional Signal Processing - Inside …inside.mines.edu/~whoff/courses/EENG510/lectures/12-Morphological... · Image and Multidimensional Signal Processing Professor

Colorado School of Mines Department of Electrical Engineering and Computer Science Colorado School of Mines Department of Electrical Engineering and Computer Science

Example

15

Page 16: Image and Multidimensional Signal Processing - Inside …inside.mines.edu/~whoff/courses/EENG510/lectures/12-Morphological... · Image and Multidimensional Signal Processing Professor

Colorado School of Mines Department of Electrical Engineering and Computer Science

Opening and Closing

θ

θ

f b f b b

f b f b b

• Similar to binary case

– Opening is erosion followed

by dilation

– Closing is dilation followed by

erosion

• Geometric interpretation of

opening

– Push the SE up from below

against the underside of f

– Take the highest values

achieved at every point

Opening removes small,

bright details 16

Page 17: Image and Multidimensional Signal Processing - Inside …inside.mines.edu/~whoff/courses/EENG510/lectures/12-Morphological... · Image and Multidimensional Signal Processing Professor

Colorado School of Mines Department of Electrical Engineering and Computer Science

Opening and Closing

• Geometric interpretation of closing

– Push the SE down from above against the topside of f

– Take the lowest values achieved at every point

Closing removes

small, dark details

17

Page 18: Image and Multidimensional Signal Processing - Inside …inside.mines.edu/~whoff/courses/EENG510/lectures/12-Morphological... · Image and Multidimensional Signal Processing Professor

Colorado School of Mines Department of Electrical Engineering and Computer Science

• Open the image with a structuring element,

subtract it from the original

• Leaves only details smaller than the structuring

element

• Matlab example

Top Hat Transform

)( bffh

18

I = imread('rice.png');

% Pick structuring element larger than a rice grain

background = imopen(I,strel('disk',15));

subplot(1,2,1), imshow(I);

subplot(1,2,2), imshow(background);

I2 = I-background;

figure, imshow(I2, []);

Page 19: Image and Multidimensional Signal Processing - Inside …inside.mines.edu/~whoff/courses/EENG510/lectures/12-Morphological... · Image and Multidimensional Signal Processing Professor

Colorado School of Mines Department of Electrical Engineering and Computer Science

Another example

19

• Segment the coins from the image

I = imread('pennies.tif');

I = rgb2gray(I);

imshow(I,[]);

% Pick a disk that will just fit inside the pennies

SE = strel('disk', 6, 0);

I2 = imopen(I,SE);

figure, imshow(I2,[]);

% Threshold to get the pennies

B = Iopen > 150;

figure, imshow(B);

L = bwlabel(B);

props = regionprops(L);

figure(1);

for i=1:length(props)

rectangle('Position', props(i).BoundingBox, 'EdgeColor', 'r');

end

Page 20: Image and Multidimensional Signal Processing - Inside …inside.mines.edu/~whoff/courses/EENG510/lectures/12-Morphological... · Image and Multidimensional Signal Processing Professor

Colorado School of Mines Department of Electrical Engineering and Computer Science Colorado School of Mines Department of Electrical Engineering and Computer Science

Summary / Questions

• Morphological algorithms are a useful set of tools for

extracting features of interest in a binary image,

including

– Finding connected regions

– Filtering out very large or very small regions

– Finding the boundary of regions

– Filling in the interior of regions

– Finding the “skeleton” of a region

• Morphological algorithms can be extended to grayscale

images.

– What does “dilation” and “erosion” mean for grayscale?

20


Recommended