1 chapter 5: neighborhood processing 5.1 introduction move a mask a rectangle (usually with sides of...
TRANSCRIPT
![Page 1: 1 Chapter 5: Neighborhood Processing 5.1 Introduction Move a mask A rectangle (usually with sides of odd length) or other shape over the given image](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c0261a28abf838cd5bbc/html5/thumbnails/1.jpg)
1
Chapter 5: Neighborhood Processing5.1 Introduction
• Move a mask
A rectangle (usually with sides of odd length) or other shape over the given image
![Page 2: 1 Chapter 5: Neighborhood Processing 5.1 Introduction Move a mask A rectangle (usually with sides of odd length) or other shape over the given image](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c0261a28abf838cd5bbc/html5/thumbnails/2.jpg)
2
5.1 Introduction• Mask values
• Corresponding pixel values
![Page 3: 1 Chapter 5: Neighborhood Processing 5.1 Introduction Move a mask A rectangle (usually with sides of odd length) or other shape over the given image](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c0261a28abf838cd5bbc/html5/thumbnails/3.jpg)
3
FIGURE 5.2
![Page 4: 1 Chapter 5: Neighborhood Processing 5.1 Introduction Move a mask A rectangle (usually with sides of odd length) or other shape over the given image](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c0261a28abf838cd5bbc/html5/thumbnails/4.jpg)
4
5.1 Introduction
• Allied to spatial filtering is spatial convolution
The filter must be rotated by 180° before multiplying and adding
![Page 5: 1 Chapter 5: Neighborhood Processing 5.1 Introduction Move a mask A rectangle (usually with sides of odd length) or other shape over the given image](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c0261a28abf838cd5bbc/html5/thumbnails/5.jpg)
5
5.1 Introduction
• EXAMPLE One important linear filter is to use a 3×3 mask and take the average of all nine values within the mask
![Page 6: 1 Chapter 5: Neighborhood Processing 5.1 Introduction Move a mask A rectangle (usually with sides of odd length) or other shape over the given image](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c0261a28abf838cd5bbc/html5/thumbnails/6.jpg)
6
5.1 Introduction
The result of filtering x with 3×3 averaging filter
Ch5-p.90
![Page 7: 1 Chapter 5: Neighborhood Processing 5.1 Introduction Move a mask A rectangle (usually with sides of odd length) or other shape over the given image](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c0261a28abf838cd5bbc/html5/thumbnails/7.jpg)
7
5.2 Notation• It is convenient to describe a linear filter simply
in terms of the coefficients of all the gray values of pixels within the mask
The averaging filter
![Page 8: 1 Chapter 5: Neighborhood Processing 5.1 Introduction Move a mask A rectangle (usually with sides of odd length) or other shape over the given image](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c0261a28abf838cd5bbc/html5/thumbnails/8.jpg)
8
5.2 NotationEXAMPLE The filter
would operate on gray values as
![Page 9: 1 Chapter 5: Neighborhood Processing 5.1 Introduction Move a mask A rectangle (usually with sides of odd length) or other shape over the given image](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c0261a28abf838cd5bbc/html5/thumbnails/9.jpg)
9
5.2.1 Edges of the Image• What happens at the edge of the image, where
the mask partly falls outside the image?
• There are a number of different approaches to dealing with this problem
Ignore the edges
![Page 10: 1 Chapter 5: Neighborhood Processing 5.1 Introduction Move a mask A rectangle (usually with sides of odd length) or other shape over the given image](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c0261a28abf838cd5bbc/html5/thumbnails/10.jpg)
10
5.2.1 Edges of the ImagePad with zeros
000000000
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0
000000
00
000
Mirroring2 2 3 4 5 4 3 2 1 2 3 4 4
2 2 3 4 5 4 3 2 1 2 3 4 434567
34567 6 5 4 3 2 1 2 3 4 5
7 7 6 5 4 3 2 1 2 3 4 5 5
34565
3456
![Page 11: 1 Chapter 5: Neighborhood Processing 5.1 Introduction Move a mask A rectangle (usually with sides of odd length) or other shape over the given image](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c0261a28abf838cd5bbc/html5/thumbnails/11.jpg)
11
5.3 Filtering in MATLAB
• filter2 function
• shape is optional; it describes the method for dealing with the edges
‘same’-pad with zeros
‘valid’-ignore the edges
the result is a matrix of data type double!!
![Page 12: 1 Chapter 5: Neighborhood Processing 5.1 Introduction Move a mask A rectangle (usually with sides of odd length) or other shape over the given image](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c0261a28abf838cd5bbc/html5/thumbnails/12.jpg)
12
5.3 Filtering in MATLAB
![Page 13: 1 Chapter 5: Neighborhood Processing 5.1 Introduction Move a mask A rectangle (usually with sides of odd length) or other shape over the given image](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c0261a28abf838cd5bbc/html5/thumbnails/13.jpg)
13
5.3 Filtering in MATLAB
• The result of ’same’ may also be obtained by padding with zeros and using ’valid’:
![Page 14: 1 Chapter 5: Neighborhood Processing 5.1 Introduction Move a mask A rectangle (usually with sides of odd length) or other shape over the given image](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c0261a28abf838cd5bbc/html5/thumbnails/14.jpg)
14
5.3 Filtering in MATLAB
• filter2(filter,image,’full’) returns a result larger than the original
• It does this by padding with zero and applying the filter at all places on and around the image where the mask intersects the image matrix
![Page 15: 1 Chapter 5: Neighborhood Processing 5.1 Introduction Move a mask A rectangle (usually with sides of odd length) or other shape over the given image](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c0261a28abf838cd5bbc/html5/thumbnails/15.jpg)
15
5.3 Filtering in MATLAB
• filter2 provides no mirroring option• The mirroring approach can be realized by
placing the following codes before filter2 (filter,image,’valid’)
• Where matrix x is extended to m_x, wr/wc is defined as one half total column/row number of the mask (chopping the decimal)
![Page 16: 1 Chapter 5: Neighborhood Processing 5.1 Introduction Move a mask A rectangle (usually with sides of odd length) or other shape over the given image](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c0261a28abf838cd5bbc/html5/thumbnails/16.jpg)
16
5.3 Filtering in MATLAB
• fspecial functionh = fspecial(type, parameters)>>fspecial(‘average’,[5,7]);>>fspecial(‘average’,11);
![Page 17: 1 Chapter 5: Neighborhood Processing 5.1 Introduction Move a mask A rectangle (usually with sides of odd length) or other shape over the given image](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c0261a28abf838cd5bbc/html5/thumbnails/17.jpg)
17
5.3 Filtering in MATLAB
>>imshow(uint8(cf1))
>>imshow(cf1/255)or
![Page 18: 1 Chapter 5: Neighborhood Processing 5.1 Introduction Move a mask A rectangle (usually with sides of odd length) or other shape over the given image](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c0261a28abf838cd5bbc/html5/thumbnails/18.jpg)
18
5.4 Frequencies: Low- and High-Pass Filters• Frequencies of an image are a measure of the
amount by which gray values change with distance
high-pass filter
low-pass filter
![Page 19: 1 Chapter 5: Neighborhood Processing 5.1 Introduction Move a mask A rectangle (usually with sides of odd length) or other shape over the given image](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c0261a28abf838cd5bbc/html5/thumbnails/19.jpg)
19
5.4 Frequencies: Low- and High-Pass Filters
![Page 20: 1 Chapter 5: Neighborhood Processing 5.1 Introduction Move a mask A rectangle (usually with sides of odd length) or other shape over the given image](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c0261a28abf838cd5bbc/html5/thumbnails/20.jpg)
20
FIGURE 5.5
![Page 21: 1 Chapter 5: Neighborhood Processing 5.1 Introduction Move a mask A rectangle (usually with sides of odd length) or other shape over the given image](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c0261a28abf838cd5bbc/html5/thumbnails/21.jpg)
21
5.4 Frequencies: Low- and High-Pass Filters• VALUES OUTSIDE THE RANGE 0–255
Make negative values positiveClip values
Ch5-p.100
0-255 Scaling transformation (uint8)
![Page 22: 1 Chapter 5: Neighborhood Processing 5.1 Introduction Move a mask A rectangle (usually with sides of odd length) or other shape over the given image](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c0261a28abf838cd5bbc/html5/thumbnails/22.jpg)
22
5.4 Frequencies: Low- and High-Pass Filters
0-1 Scaling transformation (double)
![Page 23: 1 Chapter 5: Neighborhood Processing 5.1 Introduction Move a mask A rectangle (usually with sides of odd length) or other shape over the given image](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c0261a28abf838cd5bbc/html5/thumbnails/23.jpg)
23
FIGURE 5.6
![Page 24: 1 Chapter 5: Neighborhood Processing 5.1 Introduction Move a mask A rectangle (usually with sides of odd length) or other shape over the given image](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c0261a28abf838cd5bbc/html5/thumbnails/24.jpg)
24
5.5 Gaussian Filters
![Page 25: 1 Chapter 5: Neighborhood Processing 5.1 Introduction Move a mask A rectangle (usually with sides of odd length) or other shape over the given image](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c0261a28abf838cd5bbc/html5/thumbnails/25.jpg)
25
FIGURE 5.8
![Page 26: 1 Chapter 5: Neighborhood Processing 5.1 Introduction Move a mask A rectangle (usually with sides of odd length) or other shape over the given image](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c0261a28abf838cd5bbc/html5/thumbnails/26.jpg)
26
5.5 Gaussian Filters
![Page 27: 1 Chapter 5: Neighborhood Processing 5.1 Introduction Move a mask A rectangle (usually with sides of odd length) or other shape over the given image](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c0261a28abf838cd5bbc/html5/thumbnails/27.jpg)
27
5.6 Edge Sharpening
• 5.6.1 Unsharp Masking
![Page 28: 1 Chapter 5: Neighborhood Processing 5.1 Introduction Move a mask A rectangle (usually with sides of odd length) or other shape over the given image](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c0261a28abf838cd5bbc/html5/thumbnails/28.jpg)
28
FIGURES 5.11 & 5.12
![Page 29: 1 Chapter 5: Neighborhood Processing 5.1 Introduction Move a mask A rectangle (usually with sides of odd length) or other shape over the given image](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c0261a28abf838cd5bbc/html5/thumbnails/29.jpg)
29
5.6.1 Unsharp Masking• The unsharp option of fspecial produces
such filters
α = 0.5, default: α = 0.2
![Page 30: 1 Chapter 5: Neighborhood Processing 5.1 Introduction Move a mask A rectangle (usually with sides of odd length) or other shape over the given image](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c0261a28abf838cd5bbc/html5/thumbnails/30.jpg)
30
5.6.2 High-Boost Filtering• Allied to unsharp masking filters are the high-
boost filters
where A is an amplification factor
If A = 1, then the high-boost filter becomes an ordinary high-pass filter
![Page 31: 1 Chapter 5: Neighborhood Processing 5.1 Introduction Move a mask A rectangle (usually with sides of odd length) or other shape over the given image](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c0261a28abf838cd5bbc/html5/thumbnails/31.jpg)
31
5.6.2 High-Boost Filtering
![Page 32: 1 Chapter 5: Neighborhood Processing 5.1 Introduction Move a mask A rectangle (usually with sides of odd length) or other shape over the given image](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c0261a28abf838cd5bbc/html5/thumbnails/32.jpg)
32
FIGURE 5.14>> x1=filter2(hb1, x);>> imshow(x1/255)
>> x2=filter2(hb2, x);>> imshow(x2/255)
![Page 33: 1 Chapter 5: Neighborhood Processing 5.1 Introduction Move a mask A rectangle (usually with sides of odd length) or other shape over the given image](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c0261a28abf838cd5bbc/html5/thumbnails/33.jpg)
33
5.7 Nonlinear Filters• Maximum filter
• Minimum filter
![Page 34: 1 Chapter 5: Neighborhood Processing 5.1 Introduction Move a mask A rectangle (usually with sides of odd length) or other shape over the given image](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c0261a28abf838cd5bbc/html5/thumbnails/34.jpg)
34
5.8 Region of Interest Processing
![Page 35: 1 Chapter 5: Neighborhood Processing 5.1 Introduction Move a mask A rectangle (usually with sides of odd length) or other shape over the given image](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c0261a28abf838cd5bbc/html5/thumbnails/35.jpg)
35
5.8.1 Regions of Interest in MATLAB
• This will bring up the iguana image (if it isn’t shown already). Vertices of the ROI can be selected with the mouse
![Page 36: 1 Chapter 5: Neighborhood Processing 5.1 Introduction Move a mask A rectangle (usually with sides of odd length) or other shape over the given image](https://reader036.vdocuments.us/reader036/viewer/2022062519/5697c0261a28abf838cd5bbc/html5/thumbnails/36.jpg)
36
5.8.2 Region of Interest Filtering