mathematical morphology in image processing dr.k.v.pramod dept. of computer applications cochin...

67
Mathematical Mathematical Morphology Morphology in in Image Processing Image Processing Dr.K.V.Pramod Dr.K.V.Pramod Dept. of Computer Applications Dept. of Computer Applications Cochin University of Sc. & Cochin University of Sc. & Technology Technology

Upload: jasmin-kelley

Post on 31-Dec-2015

220 views

Category:

Documents


5 download

TRANSCRIPT

Mathematical Mathematical MorphologyMorphology

inin

Image ProcessingImage Processing

Dr.K.V.PramodDr.K.V.PramodDept. of Computer ApplicationsDept. of Computer Applications

Cochin University of Sc. & Cochin University of Sc. & TechnologyTechnology

•What is Mathematical Morphology ?What is Mathematical Morphology ?

An (imprecise) Mathematical An (imprecise) Mathematical

answeranswer : :

•A mathematical tool for investigating A mathematical tool for investigating geometric structure in geometric structure in binarybinary and and

grayscalegrayscale images. images.

A (precise) Mathematical A (precise) Mathematical AnswerAnswer

AlgebraComplete Lattices

OperatorsErosions-Dilations

MathematicalMorphology

TopologyHit-or-Miss

GeometryConvexity - Connectivity

Distance

ApplicationsImage Processing

and Analysis

•A mathematical tool that studies A mathematical tool that studies operators on complete latticesoperators on complete lattices

•A mathematical tool that studies A mathematical tool that studies operators on complete latticesoperators on complete lattices

• With in Biology, the term morphology With in Biology, the term morphology is used for the study of the shape is used for the study of the shape and structure of animals and plants.and structure of animals and plants.

• In image processing Mathematical In image processing Mathematical morphology is theoretical framework morphology is theoretical framework for representation, description and for representation, description and pre-processing pre-processing

• Built on Minkowski set theory.Built on Minkowski set theory.

• Part of the theory of finite lattices. Part of the theory of finite lattices.

• A mathematical theory or A mathematical theory or methodology for nonlinear image methodology for nonlinear image processing.processing.

• A technique for image analysis based A technique for image analysis based on shape.on shape.

• Extremely useful, yet not often usedExtremely useful, yet not often used

Morphology - Morphology - advantagesadvantages

• Preserves edge informationPreserves edge information

• Works by using shape-based Works by using shape-based processingprocessing

• Can be designed to be idempotentCan be designed to be idempotent

• Computationally efficient Computationally efficient

Morphology - Morphology - applicationsapplications

• Image enhancementImage enhancement• Image restoration (eg. Removing scratches Image restoration (eg. Removing scratches

from digital film) from digital film) • Edge detectionEdge detection• Texture analysisTexture analysis• Noise reductionNoise reduction There are many more applications that There are many more applications that

morphology can be applied to. Morphology has morphology can be applied to. Morphology has been widely researched for use in image and been widely researched for use in image and video processing.video processing.

Some HistorySome History

Mathematical morphology was developed in the Mathematical morphology was developed in the 1970’s by1970’s by George Matheron and Jean Serra George Matheron and Jean Serra

- George Matheron (1975)- George Matheron (1975) Random Sets and Random Sets and Integral GeometryIntegral Geometry, , John WileyJohn Wiley..

– Jean Serra (1982)Jean Serra (1982) Image Analysis and Image Analysis and Mathematical MorphologyMathematical Morphology, , Academic Press.Academic Press.

– Petros Maragos (1985)Petros Maragos (1985) A Unified Theory of A Unified Theory of Translations-Invariant Systems with Applications Translations-Invariant Systems with Applications to Morphological Analysis and Coding of Imagesto Morphological Analysis and Coding of Images, , Doctoral Thesis, Georgia Tech. Doctoral Thesis, Georgia Tech.

Why we use these Why we use these techniques ?:techniques ?:

Shape Processing and AnalysisShape Processing and Analysis– Visual perception requires transformation of images Visual perception requires transformation of images so as to make explicit particular so as to make explicit particular shape informationshape information..

– Goal:Goal: Distinguish meaningful shape information Distinguish meaningful shape information from irrelevant one.from irrelevant one.

– The vast majority of shape processing and analysis The vast majority of shape processing and analysis techniques are based on designing a techniques are based on designing a shape shape operatoroperator which satisfies desirable properties. which satisfies desirable properties.

ExampleExample

Image analysis consists of Image analysis consists of obtaining measurements obtaining measurements characteristic to images characteristic to images under consideration.under consideration.

GeometricGeometric measurements measurements (e.g., object location, (e.g., object location, orientation, area, length of orientation, area, length of perimeter)perimeter)

Grayscale Images

Binary Images

Mathematical MorphologyMathematical Morphology

• Principles:Principles:

– Such further processing is performed using one or a Such further processing is performed using one or a combination of several morphological combination of several morphological

transformationstransformations. . – The transformations work in a certain The transformations work in a certain

local neighborhood of each pixel local neighborhood of each pixel (similarly to convolution) defined by (similarly to convolution) defined by

so called ‘so called ‘Structuring ElementStructuring Element ‘. ‘. The structuring element can be The structuring element can be square, cross-like or any other shape. square, cross-like or any other shape.

Mathematical Morphology: Mathematical Morphology: Binary ImagesBinary Images

Morphology usesMorphology uses Set TheorySet Theory as foundation for as foundation for many functions. many functions. The simplest functions to implement are The simplest functions to implement are DilationDilation and and ErosionErosion

• DilationDilation– Dilation replaces zeros neighboring to Dilation replaces zeros neighboring to

ones by ones.ones by ones.

• ErosionErosion– Erosion replaces ones neighboring to Erosion replaces ones neighboring to

zeros by zeros. zeros by zeros.

Two other basic operations areTwo other basic operations are - - Closing & OpeningClosing & Opening ClosingClosing

•Closing is Closing is dilationdilation followed by followed by erosion.erosion. •Closing merges dense of ones together, fills small Closing merges dense of ones together, fills small holes and smoothes boundaries. holes and smoothes boundaries. •Closing smoothes objects by adding pixels Closing smoothes objects by adding pixels

Opening Opening

•Opening is Opening is erosionerosion followed by followed by dilation.dilation. •Opening removes single ones, thin lines and divides Opening removes single ones, thin lines and divides objects connected objects connected with a narrow path (neck).with a narrow path (neck).•Opening smoothes objects by removing pixelsOpening smoothes objects by removing pixels

Dilation (I)Dilation (I)

• Brief DescriptionBrief Description

– One of the two basic operatorsOne of the two basic operators

– Basic effect Basic effect

• Gradually enlarge the boundaries of regions Gradually enlarge the boundaries of regions

of foreground pixels on a binary image.of foreground pixels on a binary image.

Common names: Dilate, Grow, ExpandDilate, Grow, Expand

Dilation (II)Dilation (II)

• How It WorksHow It Works

– AA: set of Euclidean coordinates corresponding to the : set of Euclidean coordinates corresponding to the

input binary imageinput binary image

– BB: set of coordinates for the structuring element: set of coordinates for the structuring element

– BBxx : translation of : translation of BB so that its origin is at so that its origin is at x.x.

– The dilation of The dilation of A A by by B B is simply the set of all points is simply the set of all points xx

such that the intersection of such that the intersection of BBxx with with AA is non-empty. is non-empty.

Dilation in 1D is defined as :Dilation in 1D is defined as :

• A + B = {x : (A + B = {x : (ḂḂ))xx (intersection) (intersection) A ≠ Ф} = Ü A ≠ Ф} = ÜxЄBxЄB AAxx (1) (1)

• Where A and B are sets in Z. this definition Where A and B are sets in Z. this definition is also known as ‘is also known as ‘MinkowskiMinkowski AdditionAddition’. ’. This equation simply means that B is This equation simply means that B is moved over A and the intersection of B moved over A and the intersection of B reflected and translated with A is found. reflected and translated with A is found. Usually A will be the signal or image being Usually A will be the signal or image being operated on and B will be the Structuring operated on and B will be the Structuring Element’. Element’.

. . The followingThe following figure shows how dilation figure shows how dilation

works on a 1D binary signal.works on a 1D binary signal.

• The output is given by (1) and will be The output is given by (1) and will be set to one unless the input is the set to one unless the input is the inverse of the structuring element. inverse of the structuring element. For example, in the input it is ‘000’ For example, in the input it is ‘000’ would cause the output to be zero, if would cause the output to be zero, if in the SE it ‘111’. in the SE it ‘111’.

How dilation worksHow dilation works

. Dilation has several interesting properties, . Dilation has several interesting properties, which make it useful for image processing. which make it useful for image processing. These properties are: These properties are:

• Translation invariant.Translation invariant.

This means that the result of A dilated with B This means that the result of A dilated with B translated is the same as A translated dilated translated is the same as A translated dilated with B as given by:with B as given by:

(A + B)(A + B)xx = A = Axx + B + B (2)(2)

• Order invariantOrder invariant

This simply means that if several dilations are to This simply means that if several dilations are to be done, then the order in which they are done is be done, then the order in which they are done is irrelevant. The result will be same irrespective.irrelevant. The result will be same irrespective.

(A + B) + C = A + (B + C)(A + B) + C = A + (B + C) (3)(3)

• Increasing operatorIncreasing operator

This means that if a set A, is a subject of another This means that if a set A, is a subject of another set B, then the dilation of A by C is still a subset of set B, then the dilation of A by C is still a subset of B dilated by C:B dilated by C:

(A (A contained incontained in B) =› A + C B) =› A + C contained incontained in B + C B + C (4)(4)

• Scale invariantScale invariant

This means that the input and structuring element This means that the input and structuring element can be scaled, then dilated and will give the same can be scaled, then dilated and will give the same as scaling the dilated output:as scaling the dilated output:

rA + rB = r(A + B)rA + rB = r(A + B) (5)(5)

Where r is a scale factor.Where r is a scale factor.

These properties can be very useful in These properties can be very useful in image processing and can result in some image processing and can result in some operations being simplified. operations being simplified.

Dilation (III)Dilation (III)

• Guideline for UseGuideline for Use

Effect of dilation using a 3×3 square structuring element

3×3 square structuring element

Set of coordinate points ={ (-1, -1), (0, -1), (1, -1), (-1, 0), (0, 0), (1, 0), (-1, 1), (0, 1), (1, 1) }

Dilation (IV)Dilation (IV)– Example: Binary dilation Example: Binary dilation

– Note that the corners have been rounded off.Note that the corners have been rounded off.• When dilating by a disk shaped structuring element, When dilating by a disk shaped structuring element,

convex boundaries will become rounded, and concave convex boundaries will become rounded, and concave boundaries will be preserved as they are.boundaries will be preserved as they are.

Original image Thresholded image

Result of two Dilation passes using a disk shaped structuring

element of 11 pixels radius

Dilation (V)Dilation (V)

– Example: Binary dilation (eExample: Binary dilation (edge detectiondge detection))

• Dilation can also be used for edge detection by Dilation can also be used for edge detection by taking the dilation of an image and then subtracting taking the dilation of an image and then subtracting away the original image.away the original image.

Original imageResult of dilation Edge detection

Dilation (VI)Dilation (VI)– Example: Binary dilation (Example: Binary dilation (Region FillingRegion Filling))

• Dilation is also used as the basis for many Dilation is also used as the basis for many

other mathematical morphology operators, other mathematical morphology operators,

often in combination with some logical often in combination with some logical

operators.operators.

Original image Region filling

Dilation (VII)Dilation (VII)• Conditional dilationConditional dilation

– Combination of the dilation operator and a logical Combination of the dilation operator and a logical

operatoroperator

– Region filling applies logical NOT, logical AND and Region filling applies logical NOT, logical AND and

dilation iteratively. dilation iteratively.

Dilation (VIII)Dilation (VIII)

X0 One pixel which lies inside the region

Dilate the left image

Negative of the boundary

Original image

AND

Step 1 Result

Dilation (IX)Dilation (IX)

Dilate the left image

Negative of the boundary

AND

Step 2 Result

X1

Dilation (X)Dilation (X)– Repeating dilation and with the inverted Repeating dilation and with the inverted

boundary until convergence, yieldsboundary until convergence, yields

Final Result

Step 3 Result Step 4 Result Step 5 Result Step 6 Result

OR

Original image Result of Region Filling

Dilation (XI)Dilation (XI)

• Grayscale DilationGrayscale Dilation– Generally Generally brightenbrighten the image the image

• Bright regions surrounded by dark regions grow in size, and dark Bright regions surrounded by dark regions grow in size, and dark regions surrounded by bright regions shrink in size.regions surrounded by bright regions shrink in size.

– The effect of The effect of dilationdilation using a disk shaped structuring element using a disk shaped structuring element

Dilation (XII)Dilation (XII)– Example: Grayscale dilation (Example: Grayscale dilation (brighten the imagebrighten the image))

• The highlights on the bulb surface have increased in The highlights on the bulb surface have increased in

size.size.

• The dark body of the cube has shrunk in size since it is The dark body of the cube has shrunk in size since it is

darker than its surroundings.darker than its surroundings.

Original image Two passes Dilation by 3×3 flat square structuring element

Five passes Dilation by 3×3 flat square structuring element

Dilation (XIII)Dilation (XIII)

Pepper noise image Dilation by 3×3 flat square structuring element

Morphological ErosionMorphological Erosion

Pablo Picasso, Pass with the Cape, 1960

StructuringElement

Erosion (I)Erosion (I)• Brief DescriptionBrief Description

– Erosion is one of the basic operators in Erosion is one of the basic operators in

the area of mathematical morphology.the area of mathematical morphology.

– Basic effect Basic effect

• Erode away the boundaries of regions of Erode away the boundaries of regions of

foreground pixels (foreground pixels (i.e.i.e. white pixels, white pixels,

typically).typically).

Common names: Erode, Shrink, ReduceErode, Shrink, Reduce

Erosion (II)Erosion (II)• How It WorksHow It Works

– AA: set of Euclidean coordinates corresponding to : set of Euclidean coordinates corresponding to

input binary imageinput binary image

– BB : set of coordinates for the structuring element : set of coordinates for the structuring element

– BBxx : translation of : translation of BB so that its origin is at so that its origin is at x x

– The erosion of The erosion of AA by by BB is simply the set of all is simply the set of all

points points xx such that such that BBxx is a subset of is a subset of AA

The Opposite of Dilation is known as The Opposite of Dilation is known as ErosionErosion

• This is defined as:This is defined as: A Ө B = {x : (B)A Ө B = {x : (B)xx contained in A} = Π contained in A} = ΠxЄBxЄB A Axx

(6)(6)• This definition is also known as ‘This definition is also known as ‘Minkowski Minkowski

Substration’Substration’. The equation simply says, erosion . The equation simply says, erosion of A by B is the set of points x such that B of A by B is the set of points x such that B translated by x is contained in A. The following translated by x is contained in A. The following Figure shows how erosion works on a 1D binary Figure shows how erosion works on a 1D binary signal. This works in exactly the same way as signal. This works in exactly the same way as dilation. However (6) essentially says that for the dilation. However (6) essentially says that for the output to be a one, all of the inputs must be the output to be a one, all of the inputs must be the same as the structuring element. same as the structuring element.

How Erosion WorksHow Erosion Works

Erosion, like dilation also contains Erosion, like dilation also contains properties that are useful for image properties that are useful for image

processing:processing: • Translation invariant.Translation invariant. This means that the result of A eroded with B This means that the result of A eroded with B

translated is the same as A translated eroded with B translated is the same as A translated eroded with B as given by:as given by:

(A Ө B)x = Ax Ө B(A Ө B)x = Ax Ө B (7)(7)

• Order invariantOrder invariant This simply means that if several erosions are to be This simply means that if several erosions are to be

done, then the order in which they are done is done, then the order in which they are done is irrelevant. The result will be same irrespective.irrelevant. The result will be same irrespective.

(A Ө B) Ө C = A Ө (B Ө C)(A Ө B) Ө C = A Ө (B Ө C) (8)(8)

• Increasing operatorIncreasing operator This means that if a set, A, is a subject of another This means that if a set, A, is a subject of another

set, B, then the erosion of A by C is still a subset set, B, then the erosion of A by C is still a subset of B eroded by C:of B eroded by C:

(A Ө B) Ө C = A Ө C contained in B Ө C(A Ө B) Ө C = A Ө C contained in B Ө C (9)(9)

• Scale invariantScale invariant This means that the input and structuring element This means that the input and structuring element

can eb scaled, then eroded and will give the can eb scaled, then eroded and will give the same as scaling the eroded output:same as scaling the eroded output:

rA Ө rB = r(A Ө B)rA Ө rB = r(A Ө B) (10)(10)

Where r is a scale factorWhere r is a scale factor..

Erosion (III)Erosion (III)

• Guideline for UseGuideline for Use

Effect of erosion using a 3×3 square structuring element

A 3×3 square structuring element

Set of coordinate points ={ (-1, -1), (0, -1), (1, -1), (-1, 0), (0, 0), (1, 0), (-1, 1), (0, 1), (1, 1) }

Erosion (IV)Erosion (IV)

– Example: Binary erosion Example: Binary erosion

• It shows that the hole in the middle of the image increases in It shows that the hole in the middle of the image increases in size as the border shrinks.size as the border shrinks.

• Erosion using a disk shaped structuring element will tend to Erosion using a disk shaped structuring element will tend to round concave boundaries, but will preserve the shape of round concave boundaries, but will preserve the shape of convex boundaries.convex boundaries.

Original thresholded image Result of erosion four times with a disk shaped structuring element of 11 pixels in diameter

Erosion (V)Erosion (V)– Example: Binary erosion (Example: Binary erosion (separate separate

touching objectstouching objects))

Original image (a number of dark disks) Inverted image after thresholding

The result of eroding twice using a disk shaped structuring element 11 pixels in diameter

Using 9×9 square structuring elementleads to distortion of the shapes

Erosion (VI)Erosion (VI)

– Grayscale erosionGrayscale erosion• Generally Generally darkendarken the image the image

– Bright regions surrounded by dark regions shrink in size, and dark regions Bright regions surrounded by dark regions shrink in size, and dark regions surrounded by bright regions grow in size.surrounded by bright regions grow in size.

The effect of The effect of erosionerosion using a disk shaped structuring element using a disk shaped structuring element

Erosion (VII)Erosion (VII)– Example: Grayscale erosion (Example: Grayscale erosion (darken the darken the

imageimage))

• The highlights have disappearedThe highlights have disappeared..•The body of the cube has grown in size since it is The body of the cube has grown in size since it is

darker than its surroundings.darker than its surroundings.

Original image Two passes Erosion by 3×3 flat square structuring element

Five passes Erosion by 3×3 flat square structuring element

Erosion (VIII)Erosion (VIII)

– Example: Grayscale erosion (Example: Grayscale erosion (Remove salt noiseRemove salt noise))

•The noise has been removed.The noise has been removed.

•The rest of the image has been degraded significantly.The rest of the image has been degraded significantly.Salt noise image Erosion by 3×3 flat square structuring element

Opening (I)Opening (I)

• Brief DescriptionBrief Description– The Basic EffectThe Basic Effect

• Somewhat like erosion in that it tends to Somewhat like erosion in that it tends to remove some of the foreground(bright) remove some of the foreground(bright) pixels from the edges of regions of pixels from the edges of regions of foreground pixels.foreground pixels.

• To preserve To preserve foregroundforeground regions that have a regions that have a similar shape to structuring element.similar shape to structuring element.

Opening (II)Opening (II)• How It worksHow It works

– Opening is defined as an erosion followed by Opening is defined as an erosion followed by

a dilation.a dilation.

– Gray-level opening consists simply of a gray-Gray-level opening consists simply of a gray-

level erosion followed by a gray-level level erosion followed by a gray-level

dilation.dilation.

– Opening is the dual of closing.Opening is the dual of closing.

•Opening the foreground pixels with a particular Opening the foreground pixels with a particular

structuring element is equivalent to closing the structuring element is equivalent to closing the

background pixels with the same element.background pixels with the same element.

• Both dilation and erosion have interesting and Both dilation and erosion have interesting and useful properties. However, it would be useful to useful properties. However, it would be useful to have the properties of both in one function. This have the properties of both in one function. This can be done in two ways. The first method, can be done in two ways. The first method, ‘Opening’ is defined as:‘Opening’ is defined as:

A A ๐ ๐ B = (A B = (A ӨӨ B) B) ++ B B (11)(11)• This simply erodes the signal and then dilates the This simply erodes the signal and then dilates the

result as shown in Figure 3. As can be seen, the result as shown in Figure 3. As can be seen, the zeros are opened up. Any ones that are shorter zeros are opened up. Any ones that are shorter than the structuring element are removed, but than the structuring element are removed, but the rest of the signal is left unchanged. the rest of the signal is left unchanged.

• This is a very useful property as it means This is a very useful property as it means that if the filter is applied once, no more that if the filter is applied once, no more changes to the signal will result from changes to the signal will result from repeated applications is known as repeated applications is known as Idempotent:Idempotent:

(A (A ๐ ๐ B) B) ๐ ๐ B = A B = A ๐ ๐ BB (12)(12)

Opening (III)Opening (III)

• Guidelines for UseGuidelines for Use– IdempotenceIdempotence

•After the opening has been carried out, the new boundaries of After the opening has been carried out, the new boundaries of foreground regions will all be such that the structuring element fits foreground regions will all be such that the structuring element fits inside them.inside them.

•So further openings with the same element have no effectSo further openings with the same element have no effect

•Effect of opening using a 3×3 square structuring element Effect of opening using a 3×3 square structuring element

Opening (IV)Opening (IV)

• Binary Opening ExampleBinary Opening Example– Separate out the circles from the linesSeparate out the circles from the lines

•The lines have been almost completely removed while the circles remain The lines have been almost completely removed while the circles remain almost completely unaffected.almost completely unaffected.

A mixture of circle and lines

Opening with a disk shaped structuring element with 11 pixels in diameter

Opening (V)Opening (V)

• Binary Opening ExampleBinary Opening Example– Extract the horizontal and vertical lines separatelyExtract the horizontal and vertical lines separately

• There are a few glitches in rightmost image where the diagonal lines cross There are a few glitches in rightmost image where the diagonal lines cross vertical lines.vertical lines.

• These could easily be eliminated, however, using a slightly longer structuring These could easily be eliminated, however, using a slightly longer structuring element.element.

Original image The result of an Opening with 3×9 vertically oriented structuring element

The result of an Opening with 9×3 horizontally oriented structuring

element

Opening (VI)Opening (VI)

– Example: Binary opening Example: Binary opening

Original image Inverted image after thresholding

The result of an Opening with 11 pixel circular structuring element

The result of an Opening with 7 pixel circular structuring element

Opening (VII)Opening (VII)

– Example: Grayscale openingExample: Grayscale opening

• The important thing to notice here is the way in which bright features The important thing to notice here is the way in which bright features smaller than the structuring element have been greatly reduced in smaller than the structuring element have been greatly reduced in intensity.intensity.

• The fine The fine grained hair and whiskersgrained hair and whiskers have been much have been much reduced in intensity.reduced in intensity.

• Original image • Opening with a flat 5 ×5 square structuring element

Opening (VIII)Opening (VIII)• Compare Opening with ErosionCompare Opening with Erosion

– OpeningOpening• The noise has been entirely removed with relatively little The noise has been entirely removed with relatively little

degradation of the underlying image.degradation of the underlying image.

– ErosionErosion• The noise has been removed.The noise has been removed.• The rest of the image has been degraded significantly.The rest of the image has been degraded significantly.

Salt noise Image Opening with 3×3 square structuring element

Erosion by 3×3 flat square structuring element

Opening (IX)Opening (IX)

– Example: Grayscale opening (pepper noise)Example: Grayscale opening (pepper noise)

• No noise has been removedNo noise has been removed..

• At some places where two nearby noise pixels have merged At some places where two nearby noise pixels have merged

into one larger point, the noise level has even been increased.into one larger point, the noise level has even been increased.

Pepper noise image Result of Opening

Closing (I)Closing (I)

• Brief DescriptionBrief Description– Closing is one of the two important Closing is one of the two important

operators from mathematical operators from mathematical morphology.morphology.

– Closing is similar in some ways to Closing is similar in some ways to dilation in that it tends to enlarge the dilation in that it tends to enlarge the boundaries of foreground (bright) boundaries of foreground (bright) regions in an image.regions in an image.

Common names : ClosingClosing

Closing (II)Closing (II)

• How It worksHow It works

– Closing is defined as a dilation followed Closing is defined as a dilation followed

by an erosion.by an erosion.

Closing is the dual of opening.Closing is the dual of opening.

•Closing the foreground pixels with a particular Closing the foreground pixels with a particular

structuring element is equivalent to opening structuring element is equivalent to opening

the background pixels with the same element.the background pixels with the same element.

Closing …Closing …

• the opposite of opening is ‘Closing’ the opposite of opening is ‘Closing’ defined by”defined by”

• A ● B = (A + B) Ө BA ● B = (A + B) Ө B (13)(13)

• It can be seen that this closes gaps It can be seen that this closes gaps in the signal in the same way as in the signal in the same way as opening opened up gaps. Closing opening opened up gaps. Closing also has the property of being also has the property of being idempotent.idempotent.

Closing (III)Closing (III)• Guidelines for UseGuidelines for Use

– IdempotenceIdempotence• After the closing has been carried out, the After the closing has been carried out, the

background region will be such that the background region will be such that the structuring element can be made to cover structuring element can be made to cover any point in the background without any any point in the background without any part of it also covering a foreground point.part of it also covering a foreground point.

• So further closings will have no effect.So further closings will have no effect.

Effect of closing using a 3×3 square structuring element

Closing (IV)Closing (IV)

– Example: Binary closing Example: Binary closing

• If it is desired to remove the small holes while retaining the large If it is desired to remove the small holes while retaining the large holes, then we can simply perform a closing with a disk-shaped holes, then we can simply perform a closing with a disk-shaped structuring element with a diameter larger than the smaller holes, structuring element with a diameter larger than the smaller holes, but smaller than the larger holesbut smaller than the larger holes..

Original image Result of a closing with a 22 pixel diameter disk

Closing (V)Closing (V)– Example: Binary closing Example: Binary closing

• Enhance binary images of objects Enhance binary images of objects obtained from thresholding.obtained from thresholding.

• We can see that skeleton (B) is less We can see that skeleton (B) is less complex, and it better represents the complex, and it better represents the shape of the object.shape of the object.

Original image Thresholded image Result of closing with a circular structuring element of size 20

(B) The skeleton of the image produced by the closing operator

(A) The skeleton of the image which was only thresholded

Closing (VI)Closing (VI)

– Example: Grayscale closingExample: Grayscale closing• Gray-level closing can similarly be used to select and preserve particular intensity Gray-level closing can similarly be used to select and preserve particular intensity

patterns while attenuating others.patterns while attenuating others.

• Notice how the dark specks in between the bright spots in the hair have been Notice how the dark specks in between the bright spots in the hair have been largely filled in to the same color as the bright spots.largely filled in to the same color as the bright spots.

• But, the more uniformly colored nose area is largely the same intensity as before.But, the more uniformly colored nose area is largely the same intensity as before.Original image Opening with a flat 5 ×5 square

structuring element

Closing (VII)Closing (VII)– Compare Closing with DilationCompare Closing with Dilation

** ClosingClosing– The noise has been completely removed with only a little degradation to the The noise has been completely removed with only a little degradation to the

image.image.

• DilationDilation– Note that although the noise has been effectively removed, the image has Note that although the noise has been effectively removed, the image has

been degraded significantly.been degraded significantly.

Dilation by 3×3 flat square structuring element

Closing with 3×3 square structuring element

Pepper noise image

Closing (VIII)Closing (VIII)– Example: Grayscale closing (Example: Grayscale closing (salt noisesalt noise))

• No noise has been removed.No noise has been removed.

• The noise has even been increased at locations where two nearby noise pixels The noise has even been increased at locations where two nearby noise pixels have merged together into one larger spot.have merged together into one larger spot.

Salt noise image Result of Closing

‘‘Open-close’ & ‘Close-open’ Open-close’ & ‘Close-open’ filtersfilters• Both ‘Both ‘Open’Open’ and ‘ and ‘CClose’lose’ filters again have filters again have

interesting properties that would be nice to have interesting properties that would be nice to have in one filter. The opening and closing can be in one filter. The opening and closing can be combined to merge these properties. There are combined to merge these properties. There are two ways of combining these, the first of which is two ways of combining these, the first of which is known as an ‘known as an ‘Open-Close’Open-Close’ filter and is defined filter and is defined by:by:

• A O● B = (A A O● B = (A ๐ ๐ B) B) ●● B B (14)(14)• The signal is first opened and the result is then The signal is first opened and the result is then

closed. The opposite can also be done by closing closed. The opposite can also be done by closing and then opening. This is called a ‘and then opening. This is called a ‘Close-Open’Close-Open’ filter and is defined by:filter and is defined by:

• A ●O B = (A ● B) A ●O B = (A ● B) ๐ ๐ BB (15)(15)

Extending to Grey scale and Extending to Grey scale and Extending to 2D & 3D Extending to 2D & 3D

For morphology to be of use in image For morphology to be of use in image processing, it needs to be extended to non-processing, it needs to be extended to non-binary signals. There are various ways in binary signals. There are various ways in which this can be done . The chosen which this can be done . The chosen method uses very simple functions, which method uses very simple functions, which allow them to be implemented in an allow them to be implemented in an efficient way. One method of implementing efficient way. One method of implementing is is Gray scale morphology Gray scale morphology and further and further extendingextending to 2D & 3D to 2D & 3D..

THANK YOUTHANK YOU