Chapter 6: Image Geometry 6.1 Interpolation of Data • Suppose we have a collection of four values that we wish to enlarge to eight • The a and b of the linear function can be solved by • Then we can obtain the linear function (continuous) 1 6.1 Interpolation of Data • In digital (discrete), none of the points coincide exactly with an original xj, except for the first and last • We have to estimate function values based on the known values of nearby f (xj) • Such estimation of function values based on surrounding values is called interpolation • Nearest-neighbor interpolation 2 FIGURE 6.5 • Linear interpolation (Equation 6.1) 3 6.2 Image Interpolation • Using the formula given by Equation 6.1 bilinear interpolation 4 6.2 Image Interpolation • f ( x' , y ' ) f ( x 1, y 1) (1 ) f ( x 1, y ) (1 ) f ( x, y 1) (1 )(1 ) f ( x, y ) • Function imresize • Where A is an image of any type, k is a scaling factor, and ’method’ is either ’nearest’ or ’bilinear’, etc. 5 FIGURE 6.9 & 6.10 6 6.3 General Interpolation • Generalized interpolation function: (Equation 6.2) • R0(u) Nearest-neighbor interpolation 7 6.3 General Interpolation • R1(u) Linear interpolation • Cubic interpolation 8 FIGURE 6.14 9 FIGURE 6.15 10 FIGURE 6.16 11 6.4 Enlargement by Spatial Filtering • If we merely wish to enlarge an image by a power of two, there is a quick and dirty method that uses linear filtering e.g. zero-interleaved 12 FIGURE 6.17 • 13 This can be implemented with a simple function 6.4 Enlargement by Spatial Filtering We can now replace the zeros by applying a spatial filter to this matrix nearest-neighbor 14 bilinear bicubic 6.4 Enlargement by Spatial Filtering 15 FIGURE 6.18 16 6.5 Scaling Smaller • Making an image smaller is also called image minimization • Subsampling e.g. 17 FIGURE 6.19 18 6.6 Rotation 19 FIGURE 6.21 20 6.6 Rotation • In Figure 6.21, the filled circles indicate the original position, and the open circles point their positions after rotation • We must ensure that even after rotation, the points remain in that grid • To do this we consider a rectangle that includes the rotated image, as shown in Figure 6.22 21 FIGURE 6.22 22 FIGURE 6.23 23 6.6 Rotation • The gray value at (x”, y”) can be found by interpolation, using surrounding gray values. This value is then the gray value for the pixel at (x’, y’) in the rotated image 24 FIGURE 6.25 25 6.7 Anamorphosis 26 FIGURE 6.27 27 FIGURE 6.28 28