Presentation is loading. Please wait.

Presentation is loading. Please wait.

More Image Manipulation

Similar presentations


Presentation on theme: "More Image Manipulation"— Presentation transcript:

1 More Image Manipulation
Prof. Graeme Bailey (notes modified from Noah Snavely, Spring 2009)

2 Last time: image transformations

3 2D Linear Transformations
Can be represented with a 2D matrix And applied to a point using matrix multiplication

4 Forward mapping Lots of problems came up trying to enlarge a image…

5 How do we fix this? Answer: do the opposite! Create an output image
For each pixel in the output image, find the corresponding pixel in the input image* Give that output pixel the same color *Requires that we invert the mapping

6 Inverse mapping How do we invert the mapping?
With linear transformations T, we invert T

7 Inverse mapping

8 Resampling Suppose we scale image by 2 T = [ 2 0 ; 0 2 ] inv(T) = ?
Pixel (5,5) in img_out should be colored with pixel (2.5, 2.5) in img_in How do we find the intensity at (2.5, 2.5)?

9 Downsampling Suppose we scale image by 0.25 – a different problem with some surprising issues …

10 Downsampling Which pixels were picked from the larger image to choose colour values?

11 What’s going on? Aliasing can arise when you sample a continuous signal or image Occurs when the sampling rate is not high enough to capture the detail in the image Can give you the wrong signal/image—an alias

12 2D example Good sampling Bad sampling

13 Image credit: Steve Seitz
Examples of aliasing Wagon wheel effect Moiré patterns Image credit: Steve Seitz

14 Slide credits: Steve Seitz
This image is too big to fit on the screen. How can we create a half-sized version? Slide credits: Steve Seitz

15 Image sub-sampling 1/8 1/4 Current approach: throw away every other row and column (subsample)

16 Image sub-sampling 1/2 1/4 (2x zoom) 1/8 (4x zoom)

17 Image sub-sampling What’s really going on?
Which one to pick, or should we somehow merge all values?

18 Subsampling with pre-filtering
Average 2x2 Average 4x4 Average 8x8 Solution: blur the image, then subsample Filter size should double for each ½ size reduction.

19 Subsampling with pre-filtering
Average 8x8 Average 4x4 Average 2x2 Solution: blur the image, then subsample Filter size should double for each ½ size reduction.

20 Compare with 1/8 1/4

21 Weighted averaging Filtering, aka convolution (a very big topic!)
Take one image, the kernel (usually small) to act as a (weighted) averager, then slide it over another image (usually big) At each point/pixel, multiply the kernel times the image, and add up the results This is the new value of the image … example:

22 Sometimes we want many resolutions
Known as a Gaussian Pyramid [Burt and Adelson, 1983] In computer graphics, a mip map [Williams, 1983] A precursor to wavelet transform

23 More image transformations
Default rotation is around the point (0, 0) – the upper-left corner of the image This probably isn’t really what we want…

24 Translation We really want to rotate around the center of the image
Nice trick: move the center of the image to the origin, apply the default rotation, then move the center back (Moving an image is called “translation”) But technically, translation isn’t a linear function - check the two definition properties for f(v) = v + w (for some constant vector w)… f(v + u) =? f(v) + f(u) f(av) =? a f(v) Formally we call this an affine linear function LHS = v + u + w RHS = v + u + 2w LHS = av + w RHS = av + 2aw

25 Detour: Homogeneous coordinates
Add a 1 to the end of our 2D points (x, y)  (x, y, 1) “Homogeneous” 2D points We can represent transformations on 2D homogeneous coordinates as 3D matrices What does that mean we’re doing geometrically?

26 Translation via homogeneous coordinates
Other transformations just add an extra row and column with [ ] scale rotation

27 Rotation about image centre
Translate center to origin Rotate Translate back to center


Download ppt "More Image Manipulation"

Similar presentations


Ads by Google