Date post: | 01-Feb-2016 |
Category: |
Documents |
Upload: | mohamedtarek |
View: | 221 times |
Download: | 1 times |
Image Filtering
Purpose:
–Image Enhancement
–Noise Removal
–Edge Enhancement/Detection
• An image is a matrix of points called pixels
• Resolution
– 640 X 480 ( 0.3 MegaPixels)
– 1600 X 1200 ( 2 MegaPixels)
– 3872 X 2592 (10 MegaPixels)
• Grayscale: generally 8 bits per pixel Intensities in range
[0…255]
• RGB color: 3 of 8-bit color planes: IR , IG , IB
Images
Example of a grayscale image intensity I(x,y)
(0 = black, 255 = white)
255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 20 0 255 255 255 255 255 255 255
255 255 255 75 75 75 255 255 255 255 255 255
255 255 75 95 95 75 255 255 255 255 255 255
255 255 96 127 145 175 255 255 255 255 255 255
255 255 127 145 175 175 175 255 255 255 255 255
255 255 127 145 200 200 175 175 95 255 255 255
255 255 127 145 200 200 175 175 95 47 255 255
255 255 127 145 145 175 127 127 95 47 255 255
255 255 74 127 127 127 95 95 95 47 255 255
255 255 255 74 74 74 74 74 74 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 255 255 255 255
Images
=
x
y
r s t
u v w
x y z
Origin x
y Image I (x, y)
eprocessed = v*e + r*a + s*b + t*c + u*d + w*f + x*g + y*h + z*i
Filter Simple 3*3
Neighbourhood e
3*3 Filter
a b c
d e f
g h i
Original Image
Pixels
*
This process is called convolution and is repeated for every pixel in the original image to get the filtered image
Image Spatial Filtering
Simply average all of the pixels in a neighbourhood around a central value
1/9 1/9 1/9
1/9 1/9
1/9
1/9 1/9
1/9
Mean Smoothing Filters
sum of filter values = 1
Example
8 5 8 8 5 8
8 5 8 8 5 8
8 5 8 8 5 8
1
9
1 1 1
1 1 1
1 1 1
7 7 7 7 7 7
7 7 7 7 7 7
7 7 7 7 7 7
Mean Smoothing Filters
Image smoothed with mean filters
Original 33 99
Mean Smoothing Filters
Pixels closer to the central pixel are more important
1/16 2/16
1/16
2/16 4/16
2/16
1/16 2/16
1/16
Gaussian Weighted Filter
Weighted Smoothing Filters
sum of filter values = 1
Gaussian
Original image
Mean
Weighted Smoothing Filters
Example
6 7
3 7 8
2 3
4 6 7
2, 3, 3, 4, 6, 7, 7, 7, 8
Median Smoothing Filters
Noisy image 5x5 median filter 5x5 mean filter
Median Smoothing Filters
1 1 1 1 1 1 1 1 1
0 0 0 0 2 0 0 0 0
-
Edge Enhancement (Sharpening)
sum of filter values = 1
• Convert a 2D image into a set of curves
• Extracts salient features of the scene
Edge Detection
• Directional Edge Detection
• Simple mask for:
– horizontal edges
– vertical edges
-1 1
-1
1
Edge Detection
sum of filter values = 0
Sobel Filter is a combination of 2 filters:
the combined image will show edges from both directions
-1 0 1
-2 0 2
-1 0 1
-1 -2 -1
0 0 0
1 2 1
Sobel Edge Detection
xI yI
2 2
x yI I
Sobel Edge Detection
xI yI 2 2
x yI I
x
y Image I(x, y)
e
At the borders of an image we are missing pixels to form a neighbourhood
• Truncate the image
• Replicate border pixels
• Pad the image (with either
all white or all black pixels)
Dealing with Borders