130 likes | 138 Views
Learn about the methods and processes of enlarging or contracting digital images through zooming and image resizing. Understand pixel arrays, visualizing images, pixel replication, parametric forms, bilinear interpolation, and more.
E N D
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 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 Gene A. Tagliarini, PhD
Visualizing An Image Zoom 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*} 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) Gene A. Tagliarini, PhD
nz n mz m Visualizing An Image Zoom Gene A. Tagliarini, PhD
Pixel Replication • Uses a neighbor of the contracted representation • May give rise to a pixelated representation Gene A. Tagliarini, PhD
y(x) 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 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 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) Gene A. Tagliarini, PhD
ns ns+1 A B E ms y P mz C F D ms+1 x nz 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 Gene A. Tagliarini, PhD
B E A C P F D Bilinear Interpolation (continued) Gene A. Tagliarini, PhD