Title: Dr' Claude C' Chibelushi
1Fac. of Comp., Eng. Tech. Staffordshire
University
Image Processing, Computer Vision, and Pattern
Recognition
Spatial Domain Filters
Dr. Claude C. Chibelushi
2Outline
- Introduction
- Filter pass band
- Spatial domain filters
- Convolution-based filters
- Mode and median filters
- Combination of convolution-based filters
- Summary
3Introduction
Rate of intensity change gives information such
as object boundary, presence of noise, ...
4Introduction
- Filter transforms image such that
- certain type of information is retained /
emphasized while others are rejected / attenuated - based on rate of change of pixel values
5Introduction
6Filter Pass Band
- Filters let through or attenuate specific ranges
of image details - e.g. slow/gradual or fast changes in pixel value
- Hence the classification of filters into
- low-pass filters
- high-pass filters
- and other types of filters
- band-pass filters, band-reject filters,
7Filter Pass Band
- Low-pass filter
- Attenuates fast changes in pixel value but lets
through slow / gradual changes - Typical application noise removal
- Tends to blur image
8Filter Pass Band
- High-pass filter
- Attenuates slow / gradual changes in pixel value
but lets through fast changes - Typical application edge enhancement
- Tends to be sensitive to noise
- Output values may be outside numerical range of
pixel value - scaling may be required
9Spatial-Domain Filters
- Spatial-domain filters are based on moving
window techniques e.g. - convolution operation (e.g. Laplacian filter)
- sorting operation (e.g. median filter)
- pixel-counting operation (e.g. mode filter)
10Spatial-Domain Filters
- window repeatedly shifted over image
- calculations performed for each shift
- only pixels within window are considered
11Spatial-Domain Filters
- Convolution
- Many spatial-domain filters are based on
convolution - Convolution uses a moving window
- shift-multiply-add operation
12Spatial-Domain Filters
32
Output value
(-1x9)
(-1x30)
(0x29)
(0x33)
(0x39)
(1x9)
(1x2)
32
window
13Spatial-Domain Filters
- Convolution
- Shift-multiply-add operation
- weighted sum of pixel values in neighbourhood
- weights specified in mask (kernel, template, ...)
- sum entered in output image at pixel location
corresponding to mask anchor - mask shifted by one pixel
- Note shift by more than 1 pixel is sometimes
used (gives smaller output image)
14Spatial-Domain Filters
- Convolution
- Mathematical notation
Output at image row i, column j
for each mask row
for each mask column
15Spatial-Domain Filters
- Convolution pseudo code
- / at each image pixel /
- for each image row // downward window shifts
- for each image column // rightward window
shifts - / in image window covered by mask /
- for each mask row
- for each mask column
- update local cumulative weighted sum
- Note use output buffer
16Spatial-Domain Filters
- Convolution
- Warning
- Example given earlier shows common implementation
of convolution - but it actually uses formula for cross-correlation
17Spatial-Domain Filters
- Convolution-based filters
- Low-pass filter masks
18Spatial-Domain Filters
- Convolution-based filters
- High-pass filter masks
For general use combine outputs of vertical and
horizontal edge filters
19Spatial-Domain Filters
High-pass filtering (Sobel masks) note
directional sensitivity
20Spatial-Domain Filters
- Convolution-based filters
- High-pass filter masks
21Spatial-Domain Filters
- Convolution-based filters
- High-pass filter masks
22Spatial-Domain Filters
- Convolution-based filters
- High-pass filter masks
Single mask detects vertical and horizontal edges
23Spatial-Domain Filters
- Mode and median filters
- Some low-pass filters not based on convolution,
e.g. - mode filter
- output pixel value (at anchor) most common
value in neighbourhood requires local histogram
- median filter
- output pixel value (at anchor) median value
in neighbourhood requires sorting
24Spatial-Domain Filters
- Mode filter pseudo code
- / at each image pixel /
- for each image row // downward window shifts
- for each image column // rightward window
shifts -
- / in current image window /
- for each window row
- for each window column
- update local histogram
- put local mode in output buffer
-
25Spatial-Domain Filters
- Median filter pseudo code
- / at each image pixel /
- for each image row // downward window shifts
- for each image column // rightward window
shifts -
- / in current image window /
- for each window row
- for each window column
- update local sort
- put local median in output buffer
-
26Spatial-Domain Filters
- Mode and median filters
- Less blurring of edges (compared to averaging
filters) - Computational requirements may be high sorting
in the median filter
27Spatial-Domain Filters
28Spatial-Domain Filters
- Combination of convolution-based filters
- Several filtering passes may be applied to image
- passes may be parallel or sequential
- combined effect can be obtained by (one of
following) - combining results of individual passes
- combining masks into one single-pass mask
29Spatial-Domain Filters
- Combination of convolution-based filters
- Parallel passes
- e.g. combination of output of directional edge
detectors (e.g. Sobel edge detector) - each edge pixel considered as vector (with
magnitude and direction)
30Spatial-Domain Filters
- Combination of convolution-based filters
- Parallel passes
- e.g. addition of output images
Single-pass equivalent add mask coefficients
31Spatial-Domain Filters
- Combination of convolution-based filters
- Parallel passes
- addition of output images (ctd.)
- relevant property of convolution
- distributivity with addition
32Spatial-Domain Filters
- Combination of convolution-based filters
- Sequential passes
Single-pass equivalent convolve masks
33Spatial-Domain Filters
- Combination of convolution-based filters
- Sequential passes (ctd.)
- relevant property of convolution
- associativity
34Spatial-Domain Filters
- Sometimes beneficial to blur image prior to edge
detection - e.g. Canny edge detector
Increasing degree of blurring
35Summary
- Filters retain / reject image details based on
rate of change of pixel values - classes low-pass filter, high-pass filter, ...
- based on neighbourhood (window) operations
- e.g. convolution, sorting, counting operations,
- convolution-based filters use mask
36Summary
- Combination of convolution-based filters
- parallel e.g. for addition of filtered images
- add mask coefficients
- sequential convolve masks