Download 6 - NUI Galway

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Scale space wikipedia , lookup

2.5D wikipedia , lookup

Active shutter 3D system wikipedia , lookup

Charge-coupled device wikipedia , lookup

Subpixel rendering wikipedia , lookup

Original Chip Set wikipedia , lookup

Stereo display wikipedia , lookup

Apple II graphics wikipedia , lookup

Stereoscopy wikipedia , lookup

Autostereogram wikipedia , lookup

Indexed color wikipedia , lookup

Rendering (computer graphics) wikipedia , lookup

BSAVE (bitmap format) wikipedia , lookup

Edge detection wikipedia , lookup

Image editing wikipedia , lookup

Hold-And-Modify wikipedia , lookup

Image segmentation wikipedia , lookup

Spatial anti-aliasing wikipedia , lookup

Transcript
Section 7. Morphological Techniques
Castleman ch. 18
Glasbey & Horgan ch. 5
7.1 Introduction




The term 'morphology' refers to shape
Morphological image processing assumes that an image consists of structures that may be handled by
mathematical set theory
Normally applied to binary (B&W) images
A 'set' is a group of pixels
The basic ideas of set theory (picture on right)







The next picture represents an image containing 3 sets of black
pixels.
It is assumed that these black pixels belong to objects of
interest, while the other (white) pixels do not
Although B is about the same size as A, its morphology is different
One way of describing morphological differences is in terms of intersections with 'test' sets
e.g. several possible translations of D will yield D  A, but none will yield D  B
Test sets, or 'structuring elements' such as D provide a means to analyse the shape of objects in an
image
A reference pixel has to be defined for structuring elements (see picture above) - this defines where the
structuring element is placed
7.2 Basic Morphological Operations



Morphological operations transform an image
They operate by changing a pixel from black to white (or vice versa) if a defined structuring element
'fits' at that point
These operations can:

 extract information regarding the components contained in a binary image
 transform an image to remove or retain objects satisfying some criteria regarding their
structure
The shape of the structuring element directly affects the morphological operation and the information
about the image that its obtains
7.2.1 Erosion
If S is a structuring element and S has been placed with its reference pixel at (i, j), then this is denoted by
S(i, j)
If A is an object of interest (a set of black pixels) in a binary image
Then the erosion of A by S is defined as the set of all pixel locations for which S placed at those locations
is a subset of A
In set notation:
A  S = {(i,j) : S(i, j)  A}
The previous image eroded by D looks like this:


If D is placed at (i, j), then D consists of the 4 pixels (i, j), (i+1, j), (i, j+1) and (i+1, j+1)
If and only if all of these pixels are black will pixel (i, j) remain black in the eroded image
7.2.2 Dilation

Dilation is a complementary operation to erosion: it is defined as the erosion of the complement of a
set.
If AC denotes the complement of A, then the dilation of a set A by a set S is written as:
A  S = (AC  S)C
7.2.3 Opening and Closing



Opening is an erosion followed by a dilation
Closing is a dilation followed by an erosion
If a noisy image is segmented by thresholding, the resulting boundaries will be ragged, the objects will
have false holes in them, and the background will be peppered with small noise objects: successive
openings and closings can often improve this
Examples of erosion, dilation, opening and closing:
7.3 Operations for Size and Shape

For local size and shape operations, discs are often used rather than squares, since they are isotropic
(rotation invariant)

Working with big discs can be computationally expensive, so it is worth noting that eroding with two
discs, one after another, is the same as eroding with a single disc whose radius is the sum of the radii of
the two small discs
Sequences of opening and closing are often applied with structuring elements of increasing size, since
the earlier operations remove small speckle features that would otherwise interfere with the later
operations

7.3.1 The Distance Transform


Replaces pixels of one value (black or white) in a binary image with their distance to the nearest pixel
of opposite value (white or black)
Efficient distance transform algorithms exist, and can therefore be used to speed up erosion or dilation
with large discs (See Glasbey & Horgan pp.134-136)
 erosion with a disc of radius r is equivalent to removing all pixels with distance values of less
than r

 dilation is simply an eroded background
The distance transform is also useful for studying the size distribution of objects ('granulometry')
7.4 Operations for Connectivity
Thinning:
 Reduces objects to a thickness of 1 pixel
 Uses 8 structuring elements that remove pixels from the outside edges of an object
 The structuring elements are defined to identify border pixels but to reject 'critical pixels' whose
removal would fragment an object.
 These are applied by passing through the image repeatedly until an entire pass removes no pixels
Example:
When applied to an edge map produced from a blurred image (examples below), thinning has the effect of
forcing a single response to each edge, which is one of the main requirements of object extraction.
(1) original image, (2) edges detected and thresholded, (3) thinned, (4) original image blurred and edges
detected, (5) thinned
A set of templates for use by a thinning operation. In these depictions, a white pixel is one that must be part
of an object (for example, an edge pixel), a black pixel is one that must not be part of an object, and a grey
pixel is one that does not matter. Pseudocode for applying a thinning operation using these templates:
DO LOOP
FOR each pixel (x,y) in the image that is part of the object
FOR each of the thinning templates
Check each image pixel in the range (x-1,y-1) to (x+1,y+1) against
its corresponding template pixel
IF each white template pixel matches an object image pixel
AND each black template pixel matches a non-object image pixel
THEN remove pixel (x,y) from the object
LOOP WHILE any change has been made in the most recent iteration
The morphological operations in section 7.2 do not preserve connectedness - pixels that were previously
part of the same object may be broken apart
Thinning is a connectivity operation - it preserves connectivity and allows topological properties such as the
following to be determined:
 number of branches (a branch junction is a pixel with 3 neighbours)
 central axis of object
 orientation
 total length (by counting the remaining pixels)
Pruning:
 Often applied after thinning in order to remove spurs
 The technique is to look for pixels with only one neighbour that are close to a branch junction. ('Close
to' means less than a predetermined distance).
 Spurs can be removed by a series of operations to remove all endpoints (thereby shortening all
braches), followed by a series of operations to grow branches back by the same amount
 A complete pruning (removing all end points) preserves only closed loops
Thickening:
 Similar to dilation, but doesn't merge nearby objects
 Obtained by applying a thinning operation on an image's complement (i.e. thinning the background)
Example using morphological operations: (PCB analysis)
a)
b)
c)
d)
e)
f)
greyscale image of a printed circuit board
thresholded
cleaned up by opening
isolation of pads by erosion and dilation
isolation of traces by thinning
final display of traces, pads, and endpoints