1 © 2010 cengage learning engineering. all rights reserved. 1 introduction to digital image...
TRANSCRIPT
![Page 1: 1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng](https://reader031.vdocuments.net/reader031/viewer/2022013103/56649cf35503460f949c11f0/html5/thumbnails/1.jpg)
11
© 2010 Cengage Learning © 2010 Cengage Learning Engineering. All Rights Reserved.Engineering. All Rights Reserved.
1
Introduction to Digital Image Processing with MATLAB® Asia Edition
McAndrew‧Wang‧Tseng
Chapter 4:
Point Processing
![Page 2: 1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng](https://reader031.vdocuments.net/reader031/viewer/2022013103/56649cf35503460f949c11f0/html5/thumbnails/2.jpg)
22
4.1 Introduction
• Any image-processing operation transforms the gray values of the pixels.
• Image-processing operations may be divided into three classes based on the information required to perform the transformation.
© 2010 Cengage Learning © 2010 Cengage Learning Engineering. All Rights Reserved.Engineering. All Rights Reserved.Ch4-p.65
![Page 3: 1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng](https://reader031.vdocuments.net/reader031/viewer/2022013103/56649cf35503460f949c11f0/html5/thumbnails/3.jpg)
33
© 2010 Cengage Learning © 2010 Cengage Learning Engineering. All Rights Reserved.Engineering. All Rights Reserved.
From the most complex to the simplest, they are as follows: •Transforms •Neighborhood processing•Point operations
Ch4-p.65-66
4.1 Introduction
![Page 4: 1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng](https://reader031.vdocuments.net/reader031/viewer/2022013103/56649cf35503460f949c11f0/html5/thumbnails/4.jpg)
44
© 2010 Cengage Learning © 2010 Cengage Learning Engineering. All Rights Reserved.Engineering. All Rights Reserved.
(Point operations)
Ch4-p.65
FIGURE 4.1
![Page 5: 1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng](https://reader031.vdocuments.net/reader031/viewer/2022013103/56649cf35503460f949c11f0/html5/thumbnails/5.jpg)
55
4.2 Arithmetic Operations
• These operations act by applying a simple function
• In each case we may have to adjust the output slightly in order to ensure that the results are integers in the 0 . . . 255 range (type uint8)
© 2010 Cengage Learning © 2010 Cengage Learning Engineering. All Rights Reserved.Engineering. All Rights Reserved.Ch4-p.66
![Page 6: 1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng](https://reader031.vdocuments.net/reader031/viewer/2022013103/56649cf35503460f949c11f0/html5/thumbnails/6.jpg)
66
© 2010 Cengage Learning © 2010 Cengage Learning Engineering. All Rights Reserved.Engineering. All Rights Reserved.Ch4-p.67
FIGURE 4.2
![Page 7: 1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng](https://reader031.vdocuments.net/reader031/viewer/2022013103/56649cf35503460f949c11f0/html5/thumbnails/7.jpg)
77
© 2010 Cengage Learning © 2010 Cengage Learning Engineering. All Rights Reserved.Engineering. All Rights Reserved.Ch4-p.68
FIGURE 4.3
![Page 8: 1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng](https://reader031.vdocuments.net/reader031/viewer/2022013103/56649cf35503460f949c11f0/html5/thumbnails/8.jpg)
88
© 2010 Cengage Learning © 2010 Cengage Learning Engineering. All Rights Reserved.Engineering. All Rights Reserved.Ch4-p.68
FIGURE 4.4
![Page 9: 1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng](https://reader031.vdocuments.net/reader031/viewer/2022013103/56649cf35503460f949c11f0/html5/thumbnails/9.jpg)
99
© 2010 Cengage Learning © 2010 Cengage Learning Engineering. All Rights Reserved.Engineering. All Rights Reserved.Ch4-p.69
TABLE 4.1
![Page 10: 1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng](https://reader031.vdocuments.net/reader031/viewer/2022013103/56649cf35503460f949c11f0/html5/thumbnails/10.jpg)
1010
© 2010 Cengage Learning © 2010 Cengage Learning Engineering. All Rights Reserved.Engineering. All Rights Reserved.Ch4-p.69
FIGURE 4.5
![Page 11: 1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng](https://reader031.vdocuments.net/reader031/viewer/2022013103/56649cf35503460f949c11f0/html5/thumbnails/11.jpg)
1111
© 2010 Cengage Learning © 2010 Cengage Learning Engineering. All Rights Reserved.Engineering. All Rights Reserved.
COMPLEMENTS • The complement of a grayscale image is its
photographic negative• type double (0.0~1.0)1-m
• type uint8 (0~255)255-m
Ch4-p.69
4.2 Arithmetic Operations
![Page 12: 1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng](https://reader031.vdocuments.net/reader031/viewer/2022013103/56649cf35503460f949c11f0/html5/thumbnails/12.jpg)
1212
© 2010 Cengage Learning © 2010 Cengage Learning Engineering. All Rights Reserved.Engineering. All Rights Reserved.Ch4-p.70
FIGURE 4.6
![Page 13: 1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng](https://reader031.vdocuments.net/reader031/viewer/2022013103/56649cf35503460f949c11f0/html5/thumbnails/13.jpg)
1313
© 2010 Cengage Learning © 2010 Cengage Learning Engineering. All Rights Reserved.Engineering. All Rights Reserved.
4.3 Histograms
• A graph indicating the number of times each gray level occurs in the image
a = [10 10 10 10 10; 20 20 20 20 10;
50 50 50 50 50; 90 90 90 50 50]
0
1
2
3
4
5
6
7
0 10 20 50 90
Ch4-p.71
![Page 14: 1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng](https://reader031.vdocuments.net/reader031/viewer/2022013103/56649cf35503460f949c11f0/html5/thumbnails/14.jpg)
1414
© 2010 Cengage Learning © 2010 Cengage Learning Engineering. All Rights Reserved.Engineering. All Rights Reserved.Ch4-p.71
FIGURE 4.8
![Page 15: 1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng](https://reader031.vdocuments.net/reader031/viewer/2022013103/56649cf35503460f949c11f0/html5/thumbnails/15.jpg)
1515
© 2010 Cengage Learning © 2010 Cengage Learning Engineering. All Rights Reserved.Engineering. All Rights Reserved.
4.3.1 Histogram Stretching
• A table of the numbers ni of gray values
(with n = 360, as before)• We can stretch out the gray levels in the center
of the range by applying the piecewise linear function
Ch4-p.72
![Page 16: 1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng](https://reader031.vdocuments.net/reader031/viewer/2022013103/56649cf35503460f949c11f0/html5/thumbnails/16.jpg)
1616
© 2010 Cengage Learning © 2010 Cengage Learning Engineering. All Rights Reserved.Engineering. All Rights Reserved.Ch4-p.72
FIGURE 4.9
![Page 17: 1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng](https://reader031.vdocuments.net/reader031/viewer/2022013103/56649cf35503460f949c11f0/html5/thumbnails/17.jpg)
1717
© 2010 Cengage Learning © 2010 Cengage Learning Engineering. All Rights Reserved.Engineering. All Rights Reserved.
• where i is the original gray level and j is its result after the transformation
• This function has the effect of stretching the gray levels 5–9 to gray levels 2–14
Ch4-p.72
4.3.1 Histogram Stretching
![Page 18: 1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng](https://reader031.vdocuments.net/reader031/viewer/2022013103/56649cf35503460f949c11f0/html5/thumbnails/18.jpg)
1818
© 2010 Cengage Learning © 2010 Cengage Learning Engineering. All Rights Reserved.Engineering. All Rights Reserved.
• the corresponding histogram
Ch4-p.73
4.3.1 Histogram Stretching
![Page 19: 1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng](https://reader031.vdocuments.net/reader031/viewer/2022013103/56649cf35503460f949c11f0/html5/thumbnails/19.jpg)
1919
© 2010 Cengage Learning © 2010 Cengage Learning Engineering. All Rights Reserved.Engineering. All Rights Reserved.
• Use of imadjust
Ch4-p.73
FIGURE 4.10
![Page 20: 1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng](https://reader031.vdocuments.net/reader031/viewer/2022013103/56649cf35503460f949c11f0/html5/thumbnails/20.jpg)
2020
© 2010 Cengage Learning © 2010 Cengage Learning Engineering. All Rights Reserved.Engineering. All Rights Reserved.
• imadjust is designed to work equally well on images of type double, uint8, or uint16
• the values of a, b, c, and d must be between 0 and 1
• the function automatically converts the image im (if needed) to be of type double
Ch4-p.73
4.3.1 Histogram Stretching
![Page 21: 1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng](https://reader031.vdocuments.net/reader031/viewer/2022013103/56649cf35503460f949c11f0/html5/thumbnails/21.jpg)
2121
• Note that imadjust does not work quite in the same way as shown in Figure 4.9
• The imadjust function has one other optional parameter: the gamma value
© 2010 Cengage Learning © 2010 Cengage Learning Engineering. All Rights Reserved.Engineering. All Rights Reserved.Ch4-p.73-74
4.3.1 Histogram Stretching
![Page 22: 1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng](https://reader031.vdocuments.net/reader031/viewer/2022013103/56649cf35503460f949c11f0/html5/thumbnails/22.jpg)
2222
© 2010 Cengage Learning © 2010 Cengage Learning Engineering. All Rights Reserved.Engineering. All Rights Reserved.Ch4-p.74
FIGURE 4.11
![Page 23: 1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng](https://reader031.vdocuments.net/reader031/viewer/2022013103/56649cf35503460f949c11f0/html5/thumbnails/23.jpg)
2323
© 2010 Cengage Learning © 2010 Cengage Learning Engineering. All Rights Reserved.Engineering. All Rights Reserved.Ch4-p.75
FIGURE 4.12
![Page 24: 1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng](https://reader031.vdocuments.net/reader031/viewer/2022013103/56649cf35503460f949c11f0/html5/thumbnails/24.jpg)
2424
© 2010 Cengage Learning © 2010 Cengage Learning Engineering. All Rights Reserved.Engineering. All Rights Reserved.Ch4-p.76
FIGURE 4.13
![Page 25: 1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng](https://reader031.vdocuments.net/reader031/viewer/2022013103/56649cf35503460f949c11f0/html5/thumbnails/25.jpg)
2525
© 2010 Cengage Learning © 2010 Cengage Learning Engineering. All Rights Reserved.Engineering. All Rights Reserved.
• A PIECE WISE LINEAR-STRETCHING FUNCTION
• The heart of this function will be the lines
where im is the input image and out is the output image
Ch4-p.75-76
4.3.1 Histogram Stretching
![Page 26: 1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng](https://reader031.vdocuments.net/reader031/viewer/2022013103/56649cf35503460f949c11f0/html5/thumbnails/26.jpg)
2626
© 2010 Cengage Learning © 2010 Cengage Learning Engineering. All Rights Reserved.Engineering. All Rights Reserved.Ch4-p.76
FIGURE 4.14
![Page 27: 1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng](https://reader031.vdocuments.net/reader031/viewer/2022013103/56649cf35503460f949c11f0/html5/thumbnails/27.jpg)
2727
© 2010 Cengage Learning © 2010 Cengage Learning Engineering. All Rights Reserved.Engineering. All Rights Reserved.Ch4-p.78
Refer to figure 4.15Refer to figure 4.15
FIGURE 4.16
The tire image after piecewise linear-stretching and piecewise linear-stretching function.
![Page 28: 1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng](https://reader031.vdocuments.net/reader031/viewer/2022013103/56649cf35503460f949c11f0/html5/thumbnails/28.jpg)
2828
© 2010 Cengage Learning © 2010 Cengage Learning Engineering. All Rights Reserved.Engineering. All Rights Reserved.
4.3.2 Histogram Equalization
• An entirely automatic procedure
• Suppose our image has L different gray levels, 0, 1, 2, . . . , L − 1, and gray level i occurs ni
times in the image
Where n=n0 +n1 +n2 +· · ·+nL−1
Ch4-p.78
![Page 29: 1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng](https://reader031.vdocuments.net/reader031/viewer/2022013103/56649cf35503460f949c11f0/html5/thumbnails/29.jpg)
2929
© 2010 Cengage Learning © 2010 Cengage Learning Engineering. All Rights Reserved.Engineering. All Rights Reserved.
• EXAMPLE Suppose a 4-bit grayscale image has the histogram shown in Figure 4.17, associated with a table of the numbers ni of gray values
Ch4-p.78
4.3.2 Histogram Equalization
![Page 30: 1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng](https://reader031.vdocuments.net/reader031/viewer/2022013103/56649cf35503460f949c11f0/html5/thumbnails/30.jpg)
3030
© 2010 Cengage Learning © 2010 Cengage Learning Engineering. All Rights Reserved.Engineering. All Rights Reserved.Ch4-p.79
FIGURE 4.17
![Page 31: 1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng](https://reader031.vdocuments.net/reader031/viewer/2022013103/56649cf35503460f949c11f0/html5/thumbnails/31.jpg)
3131
© 2010 Cengage Learning © 2010 Cengage Learning Engineering. All Rights Reserved.Engineering. All Rights Reserved.
((LL-1)/-1)/nn
Ch4-p.79
4.3.2 Histogram Equalization
![Page 32: 1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng](https://reader031.vdocuments.net/reader031/viewer/2022013103/56649cf35503460f949c11f0/html5/thumbnails/32.jpg)
3232
© 2010 Cengage Learning © 2010 Cengage Learning Engineering. All Rights Reserved.Engineering. All Rights Reserved.Ch4-p.80
FIGURE 4.18
![Page 33: 1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng](https://reader031.vdocuments.net/reader031/viewer/2022013103/56649cf35503460f949c11f0/html5/thumbnails/33.jpg)
3333
© 2010 Cengage Learning © 2010 Cengage Learning Engineering. All Rights Reserved.Engineering. All Rights Reserved.Ch4-p.80
FIGURE 4.19
![Page 34: 1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng](https://reader031.vdocuments.net/reader031/viewer/2022013103/56649cf35503460f949c11f0/html5/thumbnails/34.jpg)
3434
© 2010 Cengage Learning © 2010 Cengage Learning Engineering. All Rights Reserved.Engineering. All Rights Reserved.Ch4-p.81
FIGURE 4.20
![Page 35: 1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng](https://reader031.vdocuments.net/reader031/viewer/2022013103/56649cf35503460f949c11f0/html5/thumbnails/35.jpg)
3535
© 2010 Cengage Learning © 2010 Cengage Learning Engineering. All Rights Reserved.Engineering. All Rights Reserved.Ch4-p.82
FIGURE 4.21
![Page 36: 1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng](https://reader031.vdocuments.net/reader031/viewer/2022013103/56649cf35503460f949c11f0/html5/thumbnails/36.jpg)
3636
© 2010 Cengage Learning © 2010 Cengage Learning Engineering. All Rights Reserved.Engineering. All Rights Reserved.
• WHY IT WORKS If we were to treat the image as a continuous function f (x, y) and the histogram as the area between different contours, then we can treat the histogram as a probability density function.
Ch4-p.82-83
4.3.2 Histogram Equalization
![Page 37: 1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng](https://reader031.vdocuments.net/reader031/viewer/2022013103/56649cf35503460f949c11f0/html5/thumbnails/37.jpg)
3737
© 2010 Cengage Learning © 2010 Cengage Learning Engineering. All Rights Reserved.Engineering. All Rights Reserved.Ch4-p.82
FIGURE 4.22
![Page 38: 1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng](https://reader031.vdocuments.net/reader031/viewer/2022013103/56649cf35503460f949c11f0/html5/thumbnails/38.jpg)
3838
© 2010 Cengage Learning © 2010 Cengage Learning Engineering. All Rights Reserved.Engineering. All Rights Reserved.
4.4 Lookup Tables
• Point operations can be performed very effectively by using a lookup table, known more simply as an LUT
• e.g., the LUT corresponding to division by 2 looks like
Ch4-p.83
![Page 39: 1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng](https://reader031.vdocuments.net/reader031/viewer/2022013103/56649cf35503460f949c11f0/html5/thumbnails/39.jpg)
3939
© 2010 Cengage Learning © 2010 Cengage Learning Engineering. All Rights Reserved.Engineering. All Rights Reserved.
• If T is a lookup table in MATLAB and im is our image, the lookup table can be applied by the simple command
• e.g.,
Ch4-p.83
>> b = b+1;
4.4 Lookup Tables
>> b2 = T(b+1);
![Page 40: 1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng](https://reader031.vdocuments.net/reader031/viewer/2022013103/56649cf35503460f949c11f0/html5/thumbnails/40.jpg)
4040
© 2010 Cengage Learning © 2010 Cengage Learning Engineering. All Rights Reserved.Engineering. All Rights Reserved.
• As another example, suppose we wish to apply an LUT to implement the contrast-stretching function
Ch4-p.83-84
4.4 Lookup Tables
![Page 41: 1 © 2010 Cengage Learning Engineering. All Rights Reserved. 1 Introduction to Digital Image Processing with MATLAB ® Asia Edition McAndrew ‧ Wang ‧ Tseng](https://reader031.vdocuments.net/reader031/viewer/2022013103/56649cf35503460f949c11f0/html5/thumbnails/41.jpg)
4141
© 2010 Cengage Learning © 2010 Cengage Learning Engineering. All Rights Reserved.Engineering. All Rights Reserved.Ch4-p.84
FIGURE 4.23