Morphological Image Processing

43
MORPHOLOGICAL IMAGE PROCESSING A SEMINAR REPORT Submitted by SARJANA SINGH in partial fulfillment for the award of the degree of BACHELOR OF TECHNOLGY In COMPUTER SCIENCES & ENGINEERING SCHOOL OF ENGINEERING COCHIN UNIVERSITY OF SCIENCE & TECHNOLOGY KOCHI- 682022 OCTOBER 2010 A-PDF Merger DEMO : Purchase from www.A-PDF.com to remove the watermark

description

A report on Morphological Image Processing presented by Sarjana Singh , a student of SOE, CUSAT (2007-2011 batch)Morphology is a theory and technique for the analysis and processing of geometrical structures, based on set theory and random functions. Morphology is most commonly applied to digital images, but it can be employed as well on graphs, meshes, solids, and many other spatial structures. Morphology was originally developed for binary images, and was later extended to grayscale functions and images. The purpose of morphological processing is primarily to remove imperfections added during segmentation. The basic operations are erosion and dilation .Using the basic operations we can perform opening and closing More advanced morphological operation can then be implemented using combination of all of these.

Transcript of Morphological Image Processing

Page 1: Morphological Image Processing

MORPHOLOGICAL IMAGE PROCESSING

A SEMINAR REPORT

Submitted by

SARJANA SINGH

in partial fulfillment for the award of the degree

of

BACHELOR OF TECHNOLGY

In

COMPUTER SCIENCES & ENGINEERING

SCHOOL OF ENGINEERING

COCHIN UNIVERSITY OF SCIENCE & TECHNOLOGY

KOCHI- 682022

OCTOBER 2010

A-PDF Merger DEMO : Purchase from www.A-PDF.com to remove the watermark

Page 2: Morphological Image Processing

Division of Computer Engineering School of Engineering

Cochin University of Science & Technology

Kochi-682022

_________________________________________________________

CERTIFICATE

Certified that this is a bonafied record of the seminar titled

MORPHOLOGICAL IMAGE PROCESSING

Done By Sarjana Singh

of VII semester Computer Science & Engineering in the year 2010 in partial fulfillment of the requirements for the award of Degree of Bachelor of Technology in Computer Science & Engineering of Cochin University of Science & Technology

Dr.David Peter S Mrs Sheena S

Head of the Division Seminar Guide

Page 3: Morphological Image Processing

ACKNOWLEDGEMENT

I am greatly indebted to Dr. David Peter, Head of Department, Division of Computer

Science, CUSAT for permitting me to undertake this work.

I express my heartfelt gratitude to my respected Seminar guide Mrs Sheena S for her

kind and inspiring advise which helped me to understand the subject and its semantic

significance.

I am extremely thankful to our seminar coordinator Mr. Sudheep Elayidom M for his

valuable suggestions for presentation issue .

I am also very thankful to my colleagues who helped and co-operated with me in conducting

the seminar by their active participation.

Page 4: Morphological Image Processing

ABSTRACT

MORPHOLOGICAL IMAGE PROCESSING

Morphology is a theory and technique for the analysis and processing of geometrical

structures, based on set theory and random functions. Morphology is most commonly

applied to digital images, but it can be employed as well on graphs, meshes, solids,

and many other spatial structures. Morphology was originally developed for binary

images, and was later extended to grayscale functions and images. The purpose of

morphological processing is primarily to remove imperfections added during segmentation.

The basic operations are erosion and dilation .Using the basic operations we can perform

opening and closingMore advanced morphological operation can then be implemented

using combinations of all of these.

Page 5: Morphological Image Processing

LIST OF FIGURES

Figure 2.1. Dialtion process 7

Figure 2.2 Morphological dialation of binary image 8

Figure 2.3 Erosion process. 9

Figure 2.5 Erosion eliminating irrelevant details 10

Figure2,6 Opening process 11

Figure 2.7 Closing process . 12

Figure 2.8 Noise filtering 12

Figure 3.1: Region filling 18

Figure 3.2: Morphological smoothing 19

Figure 3.3 Morphological gradient 22

Figure 3.4 Granulomerety 24-25

Figure 3.4 Textural segmentation 27

Page 6: Morphological Image Processing

TABLE OF CONTENTS

CHAPTER NO TITLE PAGENO

ABSTRACT i

LIST OF FIGURES ii

1. INTRODUCTION 1

1.1 PURPOSE 1

1.2 SCOPE 2

1.3 OVERALL DESCRIPTION 3

2. BASIC THEORY BEHIND COP 4

2.1 BINARY MORPHOLOGY 4

2.2 BOUNDRY CONDITION 5

2.3 MORPHOLOGICAL OPERATIONS 7

2.4 PROPERTIES OF OPEARATIONS 13

2.5 APPLICATIONS 14

3. MORPHOLOGICAL ALGORITHMS 18

3.1 REGION FILLING 18

3.2 APPLICATION OF MORPHLOGY 19

3.3 TOP HAT TRNSFORMATION 22

3.4 GRANULOMETRY 24

3.5 TEXTURAL SEGMENTATION 25

Page 7: Morphological Image Processing

4. MORPH AGE 27

4.1 BASICS 27

4.2 MORPHING SOFTWARES 30

4.3 MORPHOLOGY IN REAL WORLD 31

5. CONCLUSION 34

REFRENCES 35

Page 8: Morphological Image Processing

MORPHOLOGICAL IMAGE PROCESSING

Division of Computer Engineering, SOE 1

CHAPTER 1

INTRODUCTION

1.1 Purpose

Morphology is a theory and technique for the analysis and processing of geometrical

structures, based on set theory and random functions. Morphology is most commonly

applied to digital images, but it can be employed as well on graphs, meshes, solids, and

many other spatial structures.

Morphology was originally developed for binary images, and was later extended

to grayscale functions and images. The subsequent generalization to complete lattices is

widely accepted today as Morphology’s theoretical foundation.

1.2 Scope

Morphology is a broad set of image processing operations that process images

based on shapes. Morphological operations apply a structuring element to an input image,

creating an output image of the same size. In a morphological operation, the value of

each pixel in the output image is based on a comparison of the corresponding pixel in the

input image with its neighbors. By choosing the size and shape of the neighborhood, you

can construct a morphological operation that is sensitive to specific shapes in the input

image.

The most basic morphological operations are dilation and erosion. Dilation adds pixels to

the boundaries of objects in an image, while erosion removes pixels on object boundaries.

The number of pixels added or removed from the objects in an image depends on the size

and shape of the structuring element used to process the image. In the 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

Page 9: Morphological Image Processing

MORPHOLOGICAL IMAGE PROCESSING

Division of Computer Engineering, SOE 2

image. The rule used to process the pixels defines the operation as dilation or an erosion.

This table lists the rules for both dilation and erosion.

1.3 Overall description

Morphology is set of fundamental operations on binary images (2-D sets of boolean

values). It is a very simple, nonlinear convolution-like operation between two such sets.

Unlike linear convolution, morphology takes the Min and Max of elements in the set.

One set is the image per se; the other is the kernel of the convolution, which is called

a structuring element and has a defined origin (sometimes called the "center"). Binary

morphology is extremely important for fast, low-level image matching operations --

every commercial "machine vision" system has it because of its usefulness. Back in the

period around 1990, if you wanted to do fast pattern matching, you could buy such a

system from any one of several firms (see below). These implemented binary

morphological operations on custom systems with wide registers at about 1 billion pixel

operations/second. Today, using the destination word accumulation method

(implemented in Leptonica) on a 1 GHz CPU, you can do binary morphology up to an

order of magnitude faster! So if you need fast matching operations on binary images, read

on. And if you are doing image analysis on grayscale or color images, binary morphology

can often be used to give quick and spatially detailed "answers" to questions of interest.

Page 10: Morphological Image Processing

MORPHOLOGICAL IMAGE PROCESSING

Division of Computer Engineering, SOE 3

CHAPTER 02

BASIC THEORY BEHIND MIP

2.1. Binary Morphology

Binary morphology is about operations on sets. The sets are ON (black) pixels in a 2-

dimensional image. As with all image processing operations, there is a source image that

is operated on to produce adestination image. In the following, we use one set of

conventions to describe the erosion and dilation operations as set operations. Other

conventions exist, and you should keep this in mind when you read the literature.

The basic binary morphology operations are dilation and erosion . In a binary image, we

refer to the foreground (black) pixels variously as "black", "foreground", "ON" or "1".

We refer to the background (white) pixels variously as "white", "background", "OFF" or

"0". Loosely speaking, dilation "smears" the foreground and erosion "thins" the

foreground. These two operations are actually dual in that an erosion of the foreground is

equivalent to a dilation of the background. Dilation can be implemented as follows: start

with a cleared destination image (all OFF pixels). Then do a sequence of logical OR

operations of the source image with the destination, each time with a specific shift, as

determined by a pattern called a structuring element (Sel). The Sel is a 2-dimensional

pattern of hits, all relative to an origin that is often referred to as the center of the Sel. It is

a set as well. So there are really two sets involved in a morphological operation: the

image and a Sel. For example, consider a Sel that is a horizontal pattern of 5

contiguous hits (x,y) = {(-2,0), (-1,0), (0,0), (1,0) and (2,0)}, with an origin at (0,0). Then

a dilation of the image by this Sel involves initializing all dest pixels to OFF and then

ORing the source five times with source shifts given by the five hits in the Sel.

An erosion can be implemented in a similar way. For example, you can initialize all dest

pixels to ON and then do a set of logical ANDs between the dest and the shifted source.

But there is one important difference: you take the shift to be from the hit to

Page 11: Morphological Image Processing

MORPHOLOGICAL IMAGE PROCESSING

Division of Computer Engineering, SOE 4

the Sel origin, rather than from the origin to the hit. You can think of the Sel as a set of

vectors in two dimensions, and for erosion, you use an inversion of these vectors.

Because of the AND, you end up with ON pixels in the destination only where the hits of

the Sel can all fit on the ON pixels of the source image. In fact, the erosion can be

implemented by placing the Sel with its origin at every ON pixel in the source image and,

for every location where all hits in the Sel are placed on ON pixels in the image, an ON

pixel is produced in the destination at the location of the Sel origin. Thus, the erosion is

a pattern matching operation. The inversion of the Sel for erosion is required to make the

erosion a dual of the dilation. The prescription for erosion just given is oversimplified;

see the discussion in the next section on boundary conditions.

The inversion of the Sel for erosion is also required to make the opening, which is a

sequence of erosion followed by dilation, both using the same Sel, have the property

called idempotence. This means that if you do a second opening, there is no change after

the first one. Operations that are idempotent have a special significance. The opening can

be visualized as follows: it gives you only those ON pixels where the Sel is able to fit

entirely in the foreground. (The erosion gave on pixels only at the Sel origin location of

such a pattern match. Then by dilating those pixels, with the same Sel, you get all the

pixels in the match.) So the opening projects out a subset of pixels of the source image,

and a second opening gives the same result because the Sel fits in those pixels by

construction. The closing, which is a dilation followed by an erosion with the same Sel, is

also idempotent. It is the dual to the opening, because you can do a closing by opening

the background. Regardless of the convention that is used to define erosion and dilation,

the opening and closing operations have a unique definition. All four morphological

operations have two important properties:

1. Translational invariance. The operation commutes with translation: if you

translate the source and perform an operation, you get the same result as if you

performed the operation first and then translated the result.

2. Increasing. If you have two images, one of which has a foreground that is entirely

contained in the other, then the results of a morphological operation retain the

same order of inclusion.

Page 12: Morphological Image Processing

MORPHOLOGICAL IMAGE PROCESSING

Division of Computer Engineering, SOE 5

2.1. Boundary Condition

Why have an entire section on boundary conditions? Why not simply adopt a

mathematically elegant definition, and use it. For natural images, where there is no a

priori bias toward any particular grayscale value for pixels beyond the image proper, this

is a perfectly reasonable approach. For document images, however, this can give

unexpected results.

What is the mathematically elegant definition? It is the one that treats erosion and dilation

as duals, even in the presence of boundaries. We will call it the symmetric boundary

condition (SBC): extend an image by the min value (0 for binary images) for dilation and

by the max value (1 for binary images) for erosion. This gives strict duality. To avoid

confusion, we call the extra pixels that are used to extend the image beyond its actual

boundaries the frame pixels.

However, for document images, there is a natural bias toward extending the image with

background (0, OFF) pixels, for both dilation and erosion, because we typically have

background pixels at the boundaries. So we might want to handle the boundary

conditions by requiring that we get the same result as if the image were actually extended

sufficiently by 0 pixels, for all morphological operations. This does not give strict duality

between dilation and erosion, but I find it preferable for document imaging applications.

We will call this the asymmetric boundary condition (ABC).

Erosion is thus different for SBC and ABC. Suppose you have a binary image with all

pixels ON. An erosion with a 3x3 Sel flips a 1 pixel wide border around the image to

OFF using ABC, and has no effect on the image using SBC.

The most problematic operation on document images is closing. Consider a document

imaging application with binary images, and let's take a specific closing example.

Suppose you have an image with one ON pixel, located near the left hand edge at

(x=5,y=50), in an image of size 100 x 100, and you dilate with a horizontal structuring

element of width 21 pixels with the origin at its center. Here are the three cases:

Page 13: Morphological Image Processing

MORPHOLOGICAL IMAGE PROCESSING

Division of Computer Engineering, SOE 6

1. Closing using asymmetric boundary condition convention with no added border

pixels. The dilation stops at the image boundary, and you get a line only 16 ON

pixels long (5 to the boundary, the original pixel, and 10 to the right of the

original pixel). The subsequent erosion with a 21 pixel wide Sel removes it

entirely, because there is no location in which all 21 pixels of the Sel are covered

by ON pixels. Removal of the original pixel is not typically what you want for a

closing operation.

2. Closing using asymmetric b.c. with added OFF border pixels. The dilation

expands the orignal pixel into a line of length 21 that includes 5 frame pixels, and

the subsequent erosion leaves a single pixel, the same one that you started with.

3. Closing using a symmetric b.c.. As we will see, this can be implemented without

any actual frame pixels being added. But for visualization purposes, imagine there

is a frame of OFF pixels for the dilation, which expands the original pixel into a

line 21 pixels long, including 5 in the frame. Then change the frame pixels to ON

and perform the erosion. Because there are now an infinite number of ON pixels

in the frame, the erosion only removes the 10 pixels to the right of the original

pixel. The original pixel and the five pixels to its left remain ON. (Remember, the

erosion leaves the Sel origin ON if all hits in the Sel are covered by ON pixels.)

So we get three different results! The third result, where pixels can be connected with the

boundary by the closing, is the mathematically correct one in terms of strict duality

(SBC), but for document images, does one really want the closing operation to close gaps

from image pixels to the boundary? The first result loses the original pixel, which is also

likely to be undesirable. Only the second result gives us an image that seems intuitively

correct for a situation where the image seems naturally to be extended by OFF pixels

because the foreground pixels are assumed to be localized to the actual image (without a

frame). Note that the second result is independent of the location of the actual image

boundary. This is the reason that we're considering boundary conditions in some detail: I

prefer ABC for document images.

Page 14: Morphological Image Processing

MORPHOLOGICAL IMAGE PROCESSING

Division of Computer Engineering, SOE 7

2.2 Morphological operations

1.Dialation:

Dilation adds pixels to the boundaries of objects in an image. The value of the output

pixel is the maximum value of all the pixels in the input pixel's neighborhood.

The dilation of A by the structuring element B is defined by:

Example application: Assume we have received a fax of a dark photocopy. Everything

looks like it was written with a pen that is bleeding. Erosion process will allow thicker

lines to get skinny and detect the hole inside the letter "o".

Fig:2.1

The erosion of the dark-blue square by a disk, resulting in the light-blue square.

The following figure illustrates the dilation of a binary image. Note how the structuring

element defines the neighborhood of the pixel of interest, which is circled.

(See Understanding Structuring Elements for more information.) The dilation function

applies the appropriate rule to the pixels in the neighborhood and assigns a value to the

corresponding pixel in the output image. In the figure, the morphological dilation

Page 15: Morphological Image Processing

MORPHOLOGICAL IMAGE PROCESSING

Division of Computer Engineering, SOE 8

function sets the value of the output pixel to 1 because one of the elements in the

neighborhood defined by the structuring element is on.

Morphological Dilation of a Binary Image

Fig:2.2

2.Erosion

The value of the output pixel is the minimum value of all the pixels in the input pixel's

neighborhood. In a binary image, if any of the pixels is set to 0, the output pixel is set to

0.

The erosion of the binary image A by the structuring element B is defined by:

Example application: Dilation is the opposite of the erosion. Figures that are very lightly

drawn get thick when "dilated". Easiest way to describe it is to imagine the same fax/text

is written with a thicker pen.

Page 16: Morphological Image Processing

MORPHOLOGICAL IMAGE PROCESSING

Division of Computer Engineering, SOE 9

Fig:2.3

The dilation of the dark-blue square by a disk, resulting in the light-blue square with

rounded corners.

Dilation: Joining broken segments

One immediate advantage of the morphological approach over lowpass filtering is that

the morphological method resulted directly in a binary image, while lowpass filtering

started with producing gray-scale image.

Page 17: Morphological Image Processing

MORPHOLOGICAL IMAGE PROCESSING

Division of Computer Engineering, SOE 10

Fig:2.4

Erosion & Dilation: eliminating irrelevant detail

Suppose we want to eliminate all the squares except largest one. We can do this by

eroding the image with a structuring element of a size somewhat smaller than

the objects we wish to keep. After that, we can restore it by dilating them with the same

structuring element we used for erosion.

Fig:2.5

3.Opening

Opening generally smoothes the contour object,breaks narrow isthmuses, and eliminates

thin protrusions. Opening decreases sizes of the small bright detail, with no appreciable

effect on the darker gray levels, while the closing decreases sizes of the small dark

details, with relatively little effect on bright features.

Opening generally smoothes the contour object, breaks narrow isthmuses, and eliminates

thin protrusions.

Page 18: Morphological Image Processing

MORPHOLOGICAL IMAGE PROCESSING

Division of Computer Engineering, SOE 11

The opening of A by B is obtained by the erosion of A by B, followed by dilation of the

resulting image by B:

Fig:2.6

The opening of the dark-blue square by a disk, resulting in the light-blue square with

round corners.

3.Closing

Closing also tends to smooth sections of contours but, ass opposed to opening, it

generally fuses narrow breaks and long thin gulfs, eliminates small holes, and fills gaps in

the contour.

Closing also tends to smooth sections of contours

Page 19: Morphological Image Processing

MORPHOLOGICAL IMAGE PROCESSING

Division of Computer Engineering, SOE 12

Fig:2.7

The closing of the dark-blue shape (union of two squares) by a disk, resulting in the

union of the dark-blue shape and the light-blue areas.

Opening & Closing: Noise Filter

The light elements are completely eliminated in first erosion stage, but unfortunately

image is smaller so we have to restore it with dilation (erosion then dilation →opening of

A by B). However, new gaps were created. To counter this effect we have to perform

closing on an image again.

Fig:2.8

Page 20: Morphological Image Processing

MORPHOLOGICAL IMAGE PROCESSING

Division of Computer Engineering, SOE 13

Opening: the intensity of all bright features decreased,depending on the sizes of features

compared to the SE.unlike the erosion, opening has negligible effect on the dark features,

and the effect on the background is negligible.

Closing: attenuated dark features, unaffected background.

Fig:2.9

2.4 Properties of Opening and Closing

Duality

Closing is the dual of opening:

(A ◦ B)c = Ac • ˘B

Just as erosion can be implemented using dilation (and vice versa), opening can be

implemented using closing (and vice versa)

Idempotence

An important property of opening and closing operations is that they are idempotent: if

you apply one more than once,

nothing changes after the first application. So,

A ◦ B ◦ B = A ◦ B

and

A • B • B = A • B

Page 21: Morphological Image Processing

MORPHOLOGICAL IMAGE PROCESSING

Division of Computer Engineering, SOE 14

2.5Applications of Opening and Closing

Opening and closing are the basic workhorses of morphological noise removal. Opening

removes small objects, and closing removes small holes.

Finding Things

You can also use opening and closing to find specific shapes in an image. While these

may not be ―noise‖, they

may just be other things that you don’t care about. (In this sense, perhaps noise is just

things you don’t care about?)

Opening can be used to only find things into which a specific structuring element can fit.

Subdivision into Parts

You can also extend this idea to part subdivision. Suppose that you know that a particular

object has specific parts

with specific shapes. Openings can be used to separate those parts by shaping the

structuring elements to ―fit‖ into

those parts. They don’t have to exactly match the parts—it’s sufficient to only fit into

some parts while not fitting into

others.

2.5Hit-and-Miss

When eroding, the ―0‖s in the structuring element act like ―don’t care‖ conditions—they

don’t really require that the image be on or off at that point, only that the remaining ―1‖

pixels fit inside the object. In other words, it finds places that ―look like this‖ (for the 1s),

but has no way to say ―but doesn’t look like this‖ (for the 0s). We can can combine

erosion and dilation to produce an operator that acts like this: the ―hit and miss‖ operator.

The operator takes two elements: one that must ―hit‖ and one that must ―miss‖. The

operator is defined as follows. If the structuring elements J (hit) and K (miss) are applied

to the image A: A ⊗ (J,K) = (A _ J) ∩ (Ac _ K)

Page 22: Morphological Image Processing

MORPHOLOGICAL IMAGE PROCESSING

Division of Computer Engineering, SOE 15

In other words, the structuring element J must fit inside the object and the element K

must fit outside the object at that position.

This gives us a form of binary template matching. For example, the following structuring

elements give an ―upper right‖ corner detector:

0 0 0

1 1 0

0 1 0

0 1 1

0 0 1

0 0 0

J K

The J element finds the points with connected left and lower neighbors, and the H

element finds the points without upper, upper right, and right neighbors. In some cases,

we’ll simply use a single structuring element B, with the assumption that J = B and

K = Bc. I.e., A ⊗ B = A ⊗ (B,Bc) = (AB) ∩ (Ac _ Bc)

Notice that this doesn’t, however, allow for a third case: ―don’t care‖ pixels—ones that

could be either inside or outside the shape. Some authors will for this reason write the

two operators as a single one using 1s for the hits, 0s for the misses, and ―x‖s for the

don’t-care positions. In the previous example, this would be written as

x 0 0

1 1 0

x 1 x

This form is perhaps more useful for visualizing what the structuring element is designed

to find. Remember, though, that you still have to apply two different operators, one for

hit (the 1s) and one for miss (the 0s), when implementing hit-and-miss.

EXAMPLE

Fingerprint is skeletonized. A disadvantage of this particular skeletonization algorithm is

that it leaves a considerable amount of fuzz, short As additional examples of binary image

processing, consider the types of algorithms that might be useful after the offshoots that

Page 23: Morphological Image Processing

MORPHOLOGICAL IMAGE PROCESSING

Division of Computer Engineering, SOE 16

stick out from the sides of longer segments. There are several different approaches for

eliminating these artifacts. For example, a program might loop through the image

removing the pixel at the end of every line. These pixels are identified

Page 24: Morphological Image Processing

MORPHOLOGICAL IMAGE PROCESSING

Division of Computer Engineering, SOE 17

by having only one black neighbor. Do this several times and the fuzz is removed at the

expense of making each of the correct lines shorter. A better method would loop through

the image identifying branch pixels (pixels that have more than two neighbors). Starting

with each branch pixel, count the number of pixels in each offshoot. If the number of

pixels in an offshoot is less than some value (say, 5), declare it to be fuzz, and change the

pixels in the branch from black to white.

Another algorithm might change the data from a bitmap to a vector mapped format. This

involves creating a list of the ridges contained in the image and the pixels contained in

each ridge. In the vector mapped form, each ridge in the fingerprint has an individual

identity, as opposed to an image composed of many unrelated pixels. This can be

accomplished by looping through the image looking for the endpoints of each line, the

pixels that have only one black neighbor. Starting from the endpoint, each line is traced

from pixel to connecting pixel. After the opposite end of the line is reached, all the traced

pixels are declared to be a single object, and treated accordingly in future algorithms.

Page 25: Morphological Image Processing

MORPHOLOGICAL IMAGE PROCESSING

Division of Computer Engineering, SOE 18

CHAPTER 3

MORPHOLOGICAL ALGORITHS

3.1 Region Filling

Adding the intelligence to detect a black inner point of sphere, we can use region filling

to fill up the sphere to be completely white.

Fig:3.1

• Pruning

Pruning methods are an essential complement to the procedures that tend to leave

parasitic components that need to be ―cleaned up‖ by post processing. For example, the

automated recognition of hand printed characters.

• Thickening

The structuring elements have the same form as in thinning but with all 1’s and 0’s

interchanged, However, a separate algorithm for thickening is

seldom used in practice. The usual procedure is to thin the background instead.

Page 26: Morphological Image Processing

MORPHOLOGICAL IMAGE PROCESSING

Division of Computer Engineering, SOE 19

3.2APPLICATIONS OF MORPHOLOGY

Morphological Smoothing

Since opening suppresses bright details smaller than the specified SE, and closing

suppresses dark details, they are often used in combination as morphological filters for

image smoothing and noise removal

Fig:3.2

As expected, more details are removed as the size of SE increases. In the last result, the

object of interest is extracted almost completely (noise on the lower side could not be

removed completely due to its density).

The technique shown before – an opening of the original image followed by closing the

opening – is called sometimes an alternating sequential filtering. This processing is used

in automated image analysis, in which

results at each step are compared to a specific metric.

Morphological Gradient

Dilation and erosion can be used in combination with image subtraction to obtain the

morphological gradient g of animage as g = ( f ⊕b) −( f b)

The dilation thickens regions in an image and the erosion shrinks them. Therefore, their

difference emphasizes the boundaries between regions. If the SE is relatively small,

Page 27: Morphological Image Processing

MORPHOLOGICAL IMAGE PROCESSING

Division of Computer Engineering, SOE 20

homogeneous areas will not be affected by dilation and erosion, so the subtraction tends

to eliminate them. The net result is an image with the gradient-like effect.

EROSION MORHOLOGICAL

GRADIANT

ORIGINAL DIALATION

Fig:3.3

3.3 Top‐hat and bottom‐hat transformations

Combining image subtraction with openings and closings results in top-hat and bottom-

hat transformations. The top-hat transformation of a gray-scale image f is defines as f

minus its opening:That ( f ) = f − ( f �b)

Similarly, the bottom-hat transformation of a gray-scale image f is defines as the closing

of minus f: B( f) = f •b − f

One principal application of these transforms is in removing objects from an image by

using an SE in the opening and closing that does not fit the objects to be removed. The

difference then yields an image with only the removed

Page 28: Morphological Image Processing

MORPHOLOGICAL IMAGE PROCESSING

Division of Computer Engineering, SOE 21

objects. The top-hat is used for light objects on a dark background and the bottom-hat –

for dark objects on a light background.

An important use of top-hat transformation is in correcting the effects of non-uniform

illumination

Note the enhancement of detail in the background region below the lower part of the

horse’s head.

Fig:3.4

.

Binary segmentation most simply is carried out by selecting connected components in the

image, using a seed image, a mask image (which is typically the actual image), and filling

selected connected components in the mask that have seeds in them. Here, the mask is

used to clip the filling process. In a more complicated situation, typified by a binary

image of touching coffee beans, you need to split binary connected components. This can

be done using the distance function and looking for low saddle points that are most easily

cut through. How do you do that? Put the distance function upside-down. Then the seeds,

which are the local maxima of the distance function (the points that are farthest from the

Page 29: Morphological Image Processing

MORPHOLOGICAL IMAGE PROCESSING

Division of Computer Engineering, SOE 22

boundaries) are at the bottom of the inverted function. The boundaries are at the highest

point, and the "low passes" through the saddle are on the boundaries of the catchment

basins. Segmentation is achieved by filling the basins to define the watersheds, which are

all the points that drain into the same basin.

Similarly, grayscale segmentation usually proceeds by finding markers, or "seeds," and

an image of catchment basins surrounded by walls at the boundaries. The catchment

filling "mask" can be computed in various ways; a popular one is to use a properly

smoothed morphological gradient, which has large peaks at places where the image

intensity is rapidly varying -- a likely position to find a segmentation boundary. Filling

then proceeds from the seeds into these basins.

There are various ways to get the seeds. Two popular ones are tophat and h-

dome transforms. The tophat is simpler, and you can envision its operation as follows.

Suppose you have a dark grayscale image with some small bright regions. To identify

those regions, apply the tophat, using a SE that is larger than the extent of the regions.

The opening is a Minoperation that removes those bright regions that are smaller in

dimension than the SE used in the opening. Then, subtracting this image with the thin

peaks cut off from the original image gives you just those peaks, plus some low

amplitude noise. The tophat is typically followed by a thresholding operation on the

peaks. We've just described the whitetophat. There is a black tophat that is a dual to the

white tophat, and it subtracts the original image from the closing with a SE. The black

tophat gives large pixel values in the result where there were small dark regions in the

original image.

The h-domes are another method for finding local maxima. They use a grayscale

reconstruction (seed filling) method, where the original image is the mask and the seed is

derived from the mask by subtracting a constant value "h" from each pixel value.

Reconstruction expands the seed into the original image (mask). This is visualized as

having each local maximum of the seed expand horizontally until it hits a value of the

mask that is of equal or greater value, at which point it can expand no further. To

complete the h-dome transform, the filled seed is then subtracted from the original image,

Page 30: Morphological Image Processing

MORPHOLOGICAL IMAGE PROCESSING

Division of Computer Engineering, SOE 23

resulting in an image composed of the "domes" of local maxima of the original, none of

which can exceed the value h in size.

You can find implementations of the tophat transform pixTophat() and the hdome

transform pixHDome() in morphapp.c. We have implemented both black and white

tophat transforms, even though they are trivially related. Intuitively, applying a black

tophat to find small dark regions should be equivalent to applying a white tophat to the

inverse of the image. (The inverse of an image is found by replacing each pixel by its

reflection in the light-dark axis; specifically, if the pixel has value v, it is replaced by the

value 255 - v.) And, in fact, this is correct. These operations have exactly that simple

duality relation: the white tophat on an image is equal to the black tophat on the inverse

of the image, and v.v. The proof, which uses the duality of the opening and closing

operations, is very simple. Let the opening of an image I with a structuring element S be

given by OS(I), and the closing of I by S be CS(I). From here on, due to a typographic

limitation of HTML, we'll suppress the "S". Denote the inverse of an image I by I,

where I = 255 - I. The opening and closing are dual, in the sense that O(I) = C(I). (Note

that this is a different sense of "dual" than for the black and white tophats, which we are

in the process of showing.) Denote the white tophat by Tw(I) = I - O(I) and the black

tophat by Tb(I) = C(I) - I. Then the black tophat on the inverse of I is given by

Tb(I) = C(I) - I = O(I) - I = 255 - O(I) - 255 + I = I - O(I) = Tw(I)

which is the result that was to be proven. By the way, the duality relations for opening

and closing, O(I) = C(I), or C(I) = O(I), can be stated in words in several ways. Here's

one for the second of the pair: The closing of an image can be equivalently found by

inverting the opening of the inverted image. This holds for binary as well as grayscale, of

course.

High frequency noise, which is not well filtered by the white tophat, can be greatly

reduced by doing a closing first. Likewise, an opening is often necessary before a black

tophat. The size of the SE in the opening or closing can be comparable to that used in the

tophat.

Page 31: Morphological Image Processing

MORPHOLOGICAL IMAGE PROCESSING

Division of Computer Engineering, SOE 24

(Parenthetical note. For seeing the results clearly, we provide a

function pixMaxDynamicRange() that expands the dynamic range to cover the full set of

256 values for an 8 bpp image. We let you do this with either a linear or log transform.

The latter is useful for images that cover a large dynamic range to begin with and have

small values that you wish to see and which appear black on a linear scale.)

3.4 Granulometry

Granulometry (in image processing) is a field that deals with determining the size

distribution of particles in an image. In practice, particles seldom are neatly separated,

which makes particle counting by identifying individual particles a difficult task.

Morphology can be used to estimate particle size distribution indirectly, without having

to identify and measure every particle in the image. The approach is simple With

particles of regular shapes simple. that are lighter than the background, the method

consists of

applying openings with SEs of increasing size. The opening of a particular size should

have the most effect on the particles of the same size

Then, for each opening, the sum of the pixel values in the opening is computed. This sum

(sometimes called the surface area) decreases as a function of increasing SE size since

opening decreases the intensity of light features. This procedure yields a 1D array of such

numbers: the sum

of pixels as a function of SE size. To emphasize changes between successive openings,

the differences between successive openings can be computed and plotted

The peaks in the plot are an indication of the predominant size distributions of the

particles in the image.

Page 32: Morphological Image Processing

MORPHOLOGICAL IMAGE PROCESSING

Division of Computer Engineering, SOE 25

Fig:3.5

We notice that intensity contributions from small dowels is almost eliminated in ―opening

with r = 20‖. As SE size increases, intensity contributions for larger

Fig:3.6

A difference array: two distinct peaks clearly identify the presence of

Page 33: Morphological Image Processing

MORPHOLOGICAL IMAGE PROCESSING

Division of Computer Engineering, SOE 26

two dominant object sizes of the image.

As the particles are lighter than the background, we use opening with increasing size of

structuring elements, and compute the difference between the original image and its

opening. The histogram of that difference indicates the presence of three predominant

particle sizes in the input image

3.5 Textural segmentation

The objective is to find the boundary between the two regions based on their textural

content.

The objective is to find the boundary between the two regions based on their textural

content

>Closing with successively larger structuring elements

>When the size of the structuring element corresponds to that of the small blobs, they are

removed

> A single opening is performed with a structuring element that is larger than the

separation between the large blobs-> dark region on the right

>Then, a simple thresholding yields the boundary

Page 34: Morphological Image Processing

MORPHOLOGICAL IMAGE PROCESSING

Division of Computer Engineering, SOE 27

Textural segmentation of lizard

Fig:3.7

Page 35: Morphological Image Processing

MORPHOLOGICAL IMAGE PROCESSING

Division of Computer Engineering, SOE 28

CHAPTER 4

MORPH AGE

4.1 BASICS:

Morph Age is an application for morphing faces and warping images and movies on Mac

OS X.

Morph Age works by allowing you to define curves on one or more images. Any change

made on the curves is reflected on the resulting image through the corresponding

distorsion and morphing effect. Morph Age can also work from QuickTime movies as

curves can be animated with keyframed motion. One talking face can be morphed into

another talking face as they are talking!

Morph Age comes in 2 different versions, Regular and Pro.

Regular has most of the latest advances in morphing features, including Smart

Assist and interactive preview.

Pro version has additional support for video morphing and warping, allowing

frame accurate processing and advanced keyframed animation.

Morph Age is an application for morphing/warping images and movies on Mac OS X,

such as faces, and save the result to a QuickTime movie. Morph Age works by allowing

you to define curves on one or more images. Any change made on the curves is reflected

on the resulting image through the corresponding distorsion and morphing effect. Morph

Age can also work from QuickTime movies as curves can be animated with keyframed

motion. One talking face can be morphed into another talking face as they are talking!

DEFINITELY MAC

Morph Age is a Mac software from the start. You can import various image formats from

any sources, including direct access to your iPhoto and iMovie media. You can even use

your iSight, which is bundled with almost every mac nowadays, directly from within

Page 36: Morphological Image Processing

MORPHOLOGICAL IMAGE PROCESSING

Division of Computer Engineering, SOE 29

Morph Age to import a picture or animation. The rendered animation is

in QuickTime format, enabling further composition in Final Cut Pro or iMovie, or even

export it to your video iPod!

CONTROLLING THE MORPHING ANIMATION

Morph Age can animate warp curves independently, so that different parts of the image

moves at different times (the eyes, then the ears, then the mouth...). Also, animation

effects are available, such as springy motion. Morph Age shows the result in real time, so

that you can quickly and easily prototype the transformation.

ZOOMING

Zooming allows accurate curve placement. This is necessary as Morph Age offers sub-

pixel accuracy. The real-time preview rendering can also be zoomed and can serve to

assist precise curve placement.

COLORIZING

Morph Age has colorizing options that makes it possible for Hulk-like warp effects. This

works by allowing the user to define, independently for each curve, a color that will

"bleed" on the underlying image parts. This color bleeding is animated consistently with

the deformation.

LAYERS

Layers in Morph Age is a way to express that parts of the image are above others. This is

used to express that the chin is above the clothes and that whenever the chin is moved

downwards, it should pass over them (and not under).

REAL-TIME RENDERING

Page 37: Morphological Image Processing

MORPHOLOGICAL IMAGE PROCESSING

Division of Computer Engineering, SOE 30

Morph Age uses advanced GPU rendering techniques, allowing real-time preview even

for mega-pixels images.

4.2 MORPHING SOFTWARES

1.FRACTER 1.1

Fractracer is a program for creating, exploring and rendering high-complexity 3D objects.

Fractracer uses powerful script language for defining objects, scenes, and GUI elements.

Any created object can be exported to use in other modeling software.

2.AV MP3 Player Morphing

Morph music by changing voice, tempo as well as adding effects and beats. Play, capture

& record music, convert, rip, and burn MP3s & CDs. Edit CD Cover & Label. Full

functions included to make unique CDs, movies, audio & video clips.

3.Free Fun Morphing 2.1

Free Fun Morphing creates a sequence of frames which are the transformation of the

source image to target image, giving the appearance that the source image "becomes" the

target.

4.VidMorph Pro

Mix Video and Image morphing in one media. Create video effects from digital photos,

images, home videos, movies. No technical skills required - anyone can make a photo

animation in just seconds! Save morphs in Flash, WMV, ASF, AVI, Animated GIF, ipo

5.AbroSoft FantaMorph

FantaMorph Deluxe is designed to create fantastic face morph and face composite in real

time. With our revolutionary rendering engine and a super friendly user interface,

creating face morph or face composite has never been easier and faster!

Page 38: Morphological Image Processing

MORPHOLOGICAL IMAGE PROCESSING

Division of Computer Engineering, SOE 31

6.FX Morph

Create morphing and warping images and animation sequences from still images

7. Face Morpher

Create animated transitions of one face into another in just minutes with this fully

automated face morphing program. It guesses basic spots automatically and makes

realistic animations saving you time and effort.

4.3 MORPHOLOGY IN REAL WORLD

With the advent of films like Terminator 2, Stargate, and Interview with the Vamipre,

and music videos such as Michael Jackson's "Black or White" video, a morphing craze

swept Hollywood. Everyone just had to have some sort of image transformation in their

project, no matter how small or insignificant. But how is it all done? And more

importantly, what is it?

Morphing is a technique used to transfer from one image to another. However, before you

run out and try it on your own, we should mention there is quite a bit more to it than that.

Morphing involves taking two elements, from which you want to change from one to the

other. The idea is to make it appear as if one item is physically changing into the other.

The animators select points which are simalar on the two elements. For example eyes,

ears, hair, and other such features work well for faces. When moving from two objects

that are very similar, a car to a car, or a person to a person, it's easy to find points that can

shift well. But on other objects, you need to stretch a little. Shadows should always be

matched. Open spaces always can be altered into other open spaces.

An easier application of morphing involves working with two 3D objects. In the

computer the morph program can create intermediate models for the change, so that it

looks much more like the first model is moving and reforming into the second. A good

example is the mask worn by the aliens in Stargate. When activated by the wearer, the

Page 39: Morphological Image Processing

MORPHOLOGICAL IMAGE PROCESSING

Division of Computer Engineering, SOE 32

masks would pull back to reveal the face of the person. The animators make it look like

the masks were pulling away by creating a model of the mask and then basically

morphing it into a small pack located on the wearer's back. This provided a very good

illusion.

The first major application of morphing technology was 1991's Terminator 2: Judgement

Day. Industrial Light and Magic had already suceeded in modeling and animating a

metallic creature in the shape of actor Robert Patrick, but making the transitions from the

model to the actor was another problem. Morphing allowed the team to work from the

model, slowing blending in the features of the actor, providing a smooth transformation

as the android assumed his new shape. Since this intial offering, several science fiction

films have used the morphing idea for shapeshifters of various kinds. Star Trek has been

an especially enthusiastic user of morphing, tarting with the creature in Star Trek VI: The

Undiscovered Country, and now with the shape-changing Odo and his entire race on the

syndicated television showStar Trek: Deep Space Nine.

Another good example of a morph from an actor to a 3D computer model was evident

in The Mask. In the movie the premise was that a magical mask allowed the wearer to

manipulate his/her body into all kinds of contortions, mostly resembling cartoon

animation. ILM created 3D models and animated them, then used morphing programs to

ease the transition from Jim Carrey to the model, and back.

Morph programs are also available to anybody. There are several different types

available, and there are many sites on the web which talk more about this technology. See

therelated links below for some good pages.

Morphing is just one of the latest crazes in the movies and TV. Music videos love to

make extensive use of this tool. Michael Jackson's "Black or White" video was one of the

first, with a very interesting morph sequence from person to person. However, you can

always get too much of a good thing, and many of the morphs are not much more than a

gratuitous use of the technology. Todd Vaziri has written a good page, 'Why Morph?',

describing the basics of morphing, and what should be done, and what shouldn't.

Page 40: Morphological Image Processing

MORPHOLOGICAL IMAGE PROCESSING

Division of Computer Engineering, SOE 33

Morphing has become quite a big thing in Hollywood, but along with the obvious uses,

it's now evolving into much more of a tool than a gimmick. Useful applications have

been utilized in Dragonheart,Twister, and numerous other movies. Much like other

programs it will continue to be developed and expanded for other purposes.

Page 41: Morphological Image Processing

MORPHOLOGICAL IMAGE PROCESSING

Division of Computer Engineering, SOE 34

CONCLUSION

The purpose of morphological processing is primarily to remove imperfections added

during segmentation. The basic operations are erosion and dilation .Using the basic

operations we can perform opening and closingMore advanced morphological operation

can then be implemented using combinations of all of these.

Page 42: Morphological Image Processing

MORPHOLOGICAL IMAGE PROCESSING

Division of Computer Engineering, SOE 35

REFERENCES

http://www.scipress.org/e-library/rpf/pdf/chap9/0537.PDF

http://www.cis.rit.edu/class/simg782/lectures/lecture_03/lec782_05_03.pdf

http://www.mathworks.com/access/helpdesk/help/toolbox/images/f18-12508.html

http://www.google.co.in/imgreshttp://books.google.co.in/books

http://www.networksorcery.com/enp/protocol/ipv6.htm

http://www.leptonica.com/binary-morphology.html

http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/MORSE/morph1.pdf

http://cmm.ensmp.fr/~beucher/publi/taorm.pdf

http://library.thinkquest.org/3496/nfmorph.html

http://morph-effects.software.informer.com/

http://www.macupdate.com/info.php/id/11431/morph-age

http://www.freedownloadscenter.com/Best/movie-morph.html

http://www.img.cs.titech.ac.jp/ipcv/seminar/2004-2/MorphologicalImageProcessing.pdf

Page 43: Morphological Image Processing

MORPHOLOGICAL IMAGE PROCESSING

Division of Computer Engineering, SOE 36