Enlarging or Contracting a Digital Image Zoom, zoom, zoom…
Image Resizing May either increase or decrease the total number of pixels used to represent the image The process may be viewed as projecting samples from one scale to another 11/30/2018 Gene A. Tagliarini, PhD
Pixel Arrays Start with an M row x N column array of image samples Assume a zoom factor zf so that the number of rows M* and columns N* in the zoomed image are M* = zf * M N* = zf * N 11/30/2018 Gene A. Tagliarini, PhD
Visualizing An Image Zoom 11/30/2018 Gene A. Tagliarini, PhD
More Notation and Conventions Let (assume Java): M* = (int) zf * M; N* = (int) zf * N; Assume ms and ns are row and column indices of the source, respectively, and that mz and nz are row and column indices, respectively, of the zoomed image ms ε {0,…,M} and ns ε {0,…,N} mz ε {0,…,M*} and nz ε {0,…,N*} 11/30/2018 Gene A. Tagliarini, PhD
Zooming By Pixel Replication Map the pixel coordinates (mz, nz) back to the source image coordinates (ms, ns) ms = (int) (mz/zf) ns = (int) (nz /zf) Use the value v of the nearby source image pixel v(ms, ns) 11/30/2018 Gene A. Tagliarini, PhD
Visualizing An Image Zoom nz mz m n 11/30/2018 Gene A. Tagliarini, PhD
Pixel Replication Uses a neighbor of the contracted representation May give rise to a pixelated representation 11/30/2018 Gene A. Tagliarini, PhD
A Useful Parametric Form Let: a and b be constants with a < b x ε [0, 1] y = a + (b-a) * x Note y(0) = a y(1) = b If x ε (0, 1), then a < y < b a b y(x) 11/30/2018 Gene A. Tagliarini, PhD
Extending A Useful Parametric Form Let: a and b be vectors x ε [0, 1] is scalar y = a + (b-a) * x Note y(0) = a y(1) = b If x ε (0, 1), then y lies “between” a and b in the plane determined by a and b b-a y b a 11/30/2018 Gene A. Tagliarini, PhD
Bilinear Interpolation Zoomed pixel at (mz, nz) When mapped back to the source image coordinates likely lies in a region bounded by 4 original image pixels (ms, ns) (ms+1, ns) (ms, ns+1) (ms+1, ns+1) Where ms = (int) (mz/zf) ns = (int) (nz /zf) 11/30/2018 Gene A. Tagliarini, PhD
Bilinear Interpolation (continued) The intensity of pixel P can be calculated given the intensities of pixels A, B, C, and D, with scalars x, y ε [0, 1] using: E = A + (B-A)*x F = C + (D-C)*x P = E + (F-E)*y ms ns ms+1 ns+1 A B C D P x nz F E mz y 11/30/2018 Gene A. Tagliarini, PhD
Bilinear Interpolation (continued) F E 11/30/2018 Gene A. Tagliarini, PhD