Title: Binary image processing
1Binary Image Processing
SUKHROB ATOEV
- IT CONVERGENCE AND APPLICATON ENGINEERING
- DEPARTMENT
- PUKYONG NATIONAL UNIVERSITY
2Outline
- Binary Images
- Morphological operators
- Dilation and Erosion
- Closing and Opening
- Thinning and Thickening
- Skeletonization
- Summary
3Binary Images
- Each pixel 0 or 1 background or foreground
black or white - Binary images require little memory processed
very quickly. - They are a good representation of an object if
- we are only interested in the contour of that
object - the object can be separated from the background
and from other objects (no occlusion).
4From image to binary image
- Classification dividing pixels into "foreground"
and "background" - Thresholding
- If a pixel has a value in range (min, max) it is
foreground - Often min is 0 or max is maximum pixel value
- Choice of range can be manual or automatic
- (E.g. look for peaks / valleys in histogram)
- More complex operations
- Use information from neighboring pixels
- Use properties besides pixel value (e.g.
location)
5RGB Binary
RGB image
Binary image with a thresholding 100
6Morphological operators
- Morphology "Study of Shape
- Goals of morphological operations
- Simplifies image data
- Preserves essential shape characteristics
- Eliminates noise
- Permits the underlying shape to be identified
and optimally reconstructed from their distorted,
noisy forms - Morphological operators are used to prepare
binary (thresholded) images for object
segmentation/recognition
7Morphological operators
Morphological operators often take a binary image
and a structuring element as input and combine
them using a set operator.
- Morphological operators are
- Dilation and Erosion
- Closing and Opening
- Thickening and Thinning
- Skeletonization.
8Dilation
9Dilation
Dilation enlarges a region by one pixel along
all directions.
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
0 1 1 1 1 1 1 1
0 1 1 1 1 1 1 1
0 1 1 1 1 1 1 1
0 1 1 1 1 1 1 1
0 1 1 1 1 0 0 0
0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 0
0 0 0 1 1 1 1 0
0 0 0 1 1 1 1 0
0 0 1 1 1 1 1 0
0 0 0 1 1 1 1 0
0 0 1 1 0 0 0 0
0 0 0 0 0 0 0 0
Structuring Element (S)
1 1 1
1 1 1
1 1 1
Mask used for binary morphology
Binary Image (B)
Dilation Expanding. Change a pixel
from 0 to 1 if any of the neighbors of the pixel
are 1.
10Dilation (contd)
Dilation by 3x3 mask
Dilation by 5x5 mask
11Erosion
12Erosion
Erosion removes one pixel element from the
borders.
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 1 1 0 0
0 0 0 0 1 1 0 0
0 0 0 0 1 1 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 0
0 0 0 1 1 1 1 0
0 0 0 1 1 1 1 0
0 0 1 1 1 1 1 0
0 0 0 1 1 1 1 0
0 0 1 1 0 0 0 0
0 0 0 0 0 0 0 0
Structuring Element (S)
1 1 1
1 1 1
1 1 1
Mask used for binary morphology
Binary Image (B)
Erosion Shrinking. Change a pixel
from 1 to 0 if any neighbor of the pixel are 0.
13Erosion(contd)
Erosion by 3x3 mask
Erosion by 5x5 mask
14Closing
15Closing
The Closing operation performs a dilation
followed by an erosion.
0 0 0 0 0 0 0 0
0 1 1 1 1 1 1 0
0 0 1 1 1 1 1 0
0 0 1 1 1 1 1 0
0 0 1 1 1 1 1 0
0 0 1 1 1 1 1 0
0 0 1 1 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 0
0 0 0 1 1 1 1 0
0 0 0 1 1 1 1 0
0 0 1 1 1 1 1 0
0 0 0 1 1 1 1 0
0 0 1 1 0 0 0 0
0 0 0 0 0 0 0 0
Structuring Element (S)
1 1 1
1 1 1
1 1 1
Mask used for binary morphology
Binary Image (B)
Closing B?S(B S) ? S
Closing can be used to close up holes or gaps in
the object of interest.
16Closing (contd)
Closing by 3x3 mask
Closing by 5x5 mask
17Opening
18Opening
The Opening operation performs an erosion
followed by a dilation.
0 0 0 0 0 0 0 0
0 0 0 1 1 1 1 0
0 0 0 1 1 1 1 0
0 0 0 1 1 1 1 0
0 0 0 1 1 1 1 0
0 0 0 1 1 1 1 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 0
0 0 0 1 1 1 1 0
0 0 0 1 1 1 1 0
0 0 1 1 1 1 1 0
0 0 0 1 1 1 1 0
0 0 1 1 0 0 0 0
0 0 0 0 0 0 0 0
Structuring Element (S)
1 1 1
1 1 1
1 1 1
Mask used for binary morphology
Binary Image (B)
Opening can be used to eliminate point noise.
19Opening (contd)
Opening by 3x3 mask
Opening by 5x5 mask
20Binary image
Eroded
Dilated
dilated
eroded
Opened
Closed
21Thinning
22Thinning
Thinning is used to remove selected foreground
pixels, somewhat like erosion or opening.
0 0 0 0 0 0 0 0
0 1 1 1 1 1 0 0
0 0 0 0 1 1 0 0
0 0 0 0 1 1 0 0
0 0 0 0 1 1 0 0
0 0 0 1 1 1 0 0
0 0 1 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 0
0 0 0 1 1 1 1 0
0 0 0 1 1 1 1 0
0 0 1 1 1 1 1 0
0 0 0 1 1 1 1 0
0 0 1 1 0 0 0 0
0 0 0 0 0 0 0 0
Structuring Element (S)
1 1 1
1 1 1
1 1 1
Mask used for binary morphology
Binary Image (B)
Thinning is commonly used to tidy up the output
of edge detectors by reducing all lines to
single-pixel thickness.
23Thinning(contd)
Thinned image
Binary image
24Thickening
25Thickening
Thickening is used to grow selected regions of
foreground pixels, somewhat similar to dilation
or closing.
Structuring Element (S)
0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 0
1 1 1 1 1 1 1 0
0 0 1 1 1 1 1 0
0 0 1 1 1 1 1 0
0 0 1 1 1 1 1 0
0 0 1 1 1 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 0
0 0 0 1 1 1 1 0
0 0 0 1 1 1 1 0
0 0 1 1 1 1 1 0
0 0 0 1 1 1 1 0
0 0 1 1 0 0 0 0
0 0 0 0 0 0 0 0
1 1 1
1 1 1
1 1 1
Mask used for binary morphology
Binary Image (B)
26Thickening(contd)
Thickenned image
Binary image
27Skeletonization
28Skeletonization
Skeletonization is a process for reducing
foreground regions to a skeletal remnant that
largely preserves the extent and connectivity of
the original region.
The skeleton of binary image is defined by terms
of erosions and openings
Skeleton subsets
Last iterative step before B erodes to an empty
set
B Binary image C
Structuring element k Times
29Skeletonization
Structuring Element (S)
0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 0
0 0 0 1 1 1 1 0
0 0 0 1 1 1 1 0
0 0 1 1 1 1 1 0
0 0 0 1 1 1 1 0
0 0 1 1 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 1 1 1 1 1 0 0
0 0 0 0 1 1 0 0
0 0 0 0 1 1 0 0
0 0 1 1 1 1 0 0
0 0 0 1 0 0 0 0
0 0 1 0 0 0 0 0
0 0 0 0 0 0 0 0
1 1 1
1 1 1
1 1 1
Mask used for binary morphology
Skeletonization S(B)
Binary Image (B)
30Skeletonization
Binary image
After Skeletonization
31Summary
- Binary Image 0 or 1
- Morphology is an approach for processing binary
image based on its shape - The structuring element acts as a probe of the
binary image - Erosion shrinks an object Dilation expands it
- Opening erosion then dilation
- Closing dilation then erosion
- Thinning removes selected foreground pixels
- Thickening grows selected regions of foreground
pixels - Morphological skeletonization is a skeleton (or
medial axis) representation of binary image.
32Thank You