Dip Week 6 Short Noots

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Rizwan Notes (Digital Image Processing-CS-504-UAF-3(2-1)) [W-6]

Morphology
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.

Types of Morphological Operations


1. Dilation
2. Erosion
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 image. The rule used
to process the pixels defines the operation as dilation or erosion. This table lists the rules for both dilation and
erosion.
Rules for Dilation and Erosion

Example (Original and Processed Image)


Operation Rule

Dilation The value of the output pixel is


the maximum value of all pixels
in the neighborhood. In a binary
image, a pixel is set to 1 if any
of the neighboring pixels have
the value 1.
M orphological dilation makes
objects more visible and fills in
small holes in objects. Lines
appear thicker, and filled shapes
appear larger.

Erosion The value of the output pixel is


the minimum value of all pixels
in the neighborhood. In a binary
image, a pixel is set to 0 if any
of the neighboring pixels have
the value 0.
M orphological erosion removes
floating pixels and thin lines so
that only substantive objects
remain. Remaining lines appear
thinner and shapes appear
smaller.

The following figure illustrates the dilation of a binary image. The structuring element defines the neighborhood
of the pixel of interest, which is circled. 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 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. For more information, see Structuring Elements.
1
Rizwan Notes (Digital Image Processing-CS-504-UAF-3(2-1)) [W-6]

Morphological Dilation of a Binary Image

The following figure illustrates this processing for a grayscale image. The dilation function applies the rule to
the neighborhood of the circled pixel of interest. The value of the corresponding pixel in the output image is
assigned as the highest value among all neighborhood pixels. In the figure, the value of the output pixel
is 16 because it is the highest value in the neighborhood defined by the structuring element.
Morphological Dilation of a Gray-scale Image

Operations Based on Dilation and Erosion


Dilation and erosion are often used in combination to implement image processing operations. For example, the
definition of a morphological opening of an image is erosion followed by dilation, using the same structuring
element for both operations. You can combine dilation and erosion to remove small objects from an image and
smooth the border of large objects.
This table lists functions in the toolbox that perform common morphological operations that are based on
dilation and erosion.

Example (Original and Processed Image)


Function Morphological Definition

imopen Perform morphological opening. The opening


operation erodes an image and then dilates the
eroded image, using the same structuring
element for both operations.
M orphological opening is useful for removing
small objects and thin lines from an image while
preserving the shape and size of larger objects in
the image. For an example, see Use
M orphological Opening to Extract Large Image
Features.

2
Rizwan Notes (Digital Image Processing-CS-504-UAF-3(2-1)) [W-6]

Example (Original and Processed Image)


Function Morphological Definition

imclose Perform morphological closing. The closing


operation dilates an image and then erodes the
dilated image, using the same structuring
element for both operations.

M orphological closing is useful for filling small


holes in an image while preserving the shape and
size of large holes and objects in the image.

bwskel Skeletonize objects in a binary image. The


process of skeletonization erodes all objects to
centerlines without changing the essential
structure of the objects, such as the existence of
holes and branches.

bwperim Find perimeter of objects in a binary image. A


pixel is part of the perimeter if it is nonzero and
it is connected to at least one zero-valued pixel.
Therefore, edges of interior holes are considered
part of the object perimeter.

bwhitmiss Perform binary hit-miss transform. The hit-miss


transform preserves pixels in a binary image
whose neighborhoods match the shape of one
structuring element and do not match the shape
of a second disjoint structuring element.

The hit-miss transforms can be used to detect


patterns in an image.

This example uses one structuring element with


a neighborhood above and to the right of center,
and a second structuring element with a
neighborhood below and to the left of center.
The transform preserves pixels with neighbors
only to the top and right.

3
Rizwan Notes (Digital Image Processing-CS-504-UAF-3(2-1)) [W-6]

Example (Original and Processed Image)


Function Morphological Definition

imtophat Perform a morphological top-hat transform. The


top-hat transform opens an image, then subtracts
the opened image from the original image.

The top-hat transform can be used to enhance


contrast in a grayscale image with nonuniform
illumination. The transform can also isolate
small bright objects in an image.

imbothat Perform a morphological bottom-hat transform.


The bottom-hat transform closes an image, then
subtracts the original image from the closed
image.

The bottom-hat transform isolates pixels that are


darker than other pixels in their neighborhood.
Therefore, the transform can be used to find
intensity troughs in a grayscale image.

You might also like