CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring...
-
Upload
meryl-austin -
Category
Documents
-
view
225 -
download
9
Transcript of CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring...
![Page 1: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/1.jpg)
CS559: Computer Graphics
Lecture 6: Edge Detection, Image Compositing, and WarpingLi Zhang
Spring 2010
![Page 2: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/2.jpg)
Last time: Image Resampling and Painterly Rendering
![Page 3: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/3.jpg)
Last time: Image Resampling and Painterly Rendering
![Page 4: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/4.jpg)
Properties of Kernels
• Filter, Impulse Response, or kernel function, same concept but different names
• Degrees of continuity• Interpolating or no• Ringing or overshooting
Interpolating filter for reconstruction
![Page 5: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/5.jpg)
![Page 6: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/6.jpg)
![Page 7: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/7.jpg)
Reconstruction filter Examples in 2D
)1()1(],[),(
,
yxmngyxf
myynxx
otherwise 0
1,1 )1()1(),(2
yxyxyxk D
g[n,m] g[n+1,m]
g[n,m+1] g[n+1,m+1]
(x,y)
2D example:
)1(],1[ yxmng yxmng )1(]1,[
yxmng ]1,1[
How to simplify the calculation?
![Page 8: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/8.jpg)
![Page 9: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/9.jpg)
Image Downsampling
Throw away every other row and column to create a 1/2 size image
- called image sub-sampling
1/4
1/8
![Page 10: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/10.jpg)
Image sub-sampling
1/4 (2x zoom) 1/8 (4x zoom)
Why does this look so crufty?
1/2
Minimum Sampling requirement is not satisfied – resulting in Aliasing effect
![Page 11: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/11.jpg)
Subsampling with Gaussian pre-filtering
G 1/4 G 1/8Gaussian 1/2
• Solution: filter the image, then subsample
![Page 12: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/12.jpg)
Results in the paper
Original Biggest brush
Medium brush added Finest brush added
![Page 13: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/13.jpg)
Changing Parameters
![Page 14: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/14.jpg)
Changing Parameters
Impressionist, normal painting style Expressionist, elongated stroke
Colorist wash, semitransparent stroke with color jitter Densely-placed circles with random hue and saturation
![Page 15: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/15.jpg)
Another type of painterly rendering• Line Drawing
http://www.cs.rutgers.edu/~decarlo/abstract.html
![Page 16: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/16.jpg)
Another type of painterly rendering• Line Drawing
http://www.cs.rutgers.edu/~decarlo/abstract.html
![Page 17: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/17.jpg)
Another type of painterly rendering• Line Drawing
http://www.cs.rutgers.edu/~decarlo/abstract.html
![Page 18: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/18.jpg)
Another type of painterly rendering• Line Drawing
http://www.cs.rutgers.edu/~decarlo/abstract.html
![Page 19: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/19.jpg)
Edge Detection
• Convert a 2D image into a set of curves– Extracts salient features of the scene
![Page 20: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/20.jpg)
Edge detection• One of the most important uses of image
processing is edge detection:– Really easy for humans– Not that easy for computers
– Fundamental in computer vision– Important in many graphics applications
![Page 21: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/21.jpg)
What is an edge?
• Q: How might you detect an edge in 1D?
![Page 22: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/22.jpg)
Image gradient• The gradient of an image:
• The gradient direction is given by:
• The gradient points in the direction of most rapid change in intensity
– how does the gradient relate to the direction of the edge?
• The edge strength is given by the gradient magnitude
![Page 23: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/23.jpg)
Gradients• How can we approximate the gradient in a
discrete image?
gx[i,j] = f[i+1,j] – f[i,j] and gy[i,j]=f[i,j+1]-f[i,j]Can write as mask [-1 1] and [1 –1]’
![Page 24: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/24.jpg)
Less than ideal edges
![Page 25: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/25.jpg)
Results of Sobel edge detection
![Page 26: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/26.jpg)
Edge enhancement• A popular gradient magnitude computation is
the Sobel operator:
• We can then compute the magnitude of the vector (sx, sy).
1 0 1
2 0 2
1 0 1
1 2 1
0 0 0
1 2 1
x
y
s
s
![Page 27: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/27.jpg)
Results of Sobel edge detection
![Page 28: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/28.jpg)
Results of Sobel edge detection
![Page 29: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/29.jpg)
Non-maximum Suppression
• Check if pixel is local maximum along gradient direction– requires checking interpolated pixels p and r
The Canny Edge Detector
![Page 30: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/30.jpg)
Steps in edge detection• Edge detection algorithms typically proceed in
three or four steps:– Filtering: cut down on noise– Enhancement: amplify the difference between
edges and non-edges– Detection: use a threshold operation– Localization (optional): estimate geometry of
edges, which generally pass between pixels
![Page 31: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/31.jpg)
The Canny Edge Detector
original image (Lena)
![Page 32: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/32.jpg)
The Canny Edge Detector
magnitude of the gradient
![Page 33: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/33.jpg)
The Canny Edge Detector
After non-maximum suppression
![Page 34: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/34.jpg)
Canny Edge Detector
Canny with Canny with original
• The choice of depends on desired behavior
– large detects large scale edges– small detects fine features
: Gaussian filter parameter
![Page 35: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/35.jpg)
Compositing• Compositing combines components from two or
more images to make a new image– Special effects are easier to control when done in
isolation– Even many all live-action sequences are more safely
shot in different layers
![Page 36: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/36.jpg)
Compositing• Compositing combines components from two or
more images to make a new image– Special effects are easier to control when done in
isolation– Even many all live-action sequences are more safely
shot in different layers
![Page 37: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/37.jpg)
Perfect Storm
![Page 38: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/38.jpg)
Animated Example
over =
![Page 39: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/39.jpg)
Mattes
• A matte is an image that shows which parts of another image are foreground objects
• Term dates from film editing and cartoon production
• How would I use a matte to insert an object into a background?
• How are mattes usually generated for television?
![Page 40: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/40.jpg)
Working with Mattes• To insert an object into a background
– Call the image of the object the source– Put the background into the destination– For all the source pixels, if the matte is white, copy the
pixel, otherwise leave it unchanged
![Page 41: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/41.jpg)
Working with Mattes• To insert an object into a background
– Call the image of the object the source– Put the background into the destination– For all the source pixels, if the matte is white, copy the
pixel, otherwise leave it unchanged• To generate mattes:
– Use smart selection tools in Photoshop or similar• They outline the object and convert the outline to a
matte– Blue Screen: Photograph/film the object in front of a blue
background, then consider all the blue pixels in the image to be the background
![Page 42: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/42.jpg)
Compositing
• Compositing is the term for combining images, one over the other– Used to put special effects into live action
• Or live action into special effects
![Page 43: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/43.jpg)
Alpha• Basic idea: Encode opacity information in the image• Add an extra channel, the alpha channel, to each image
– For each pixel, store R, G, B and Alpha– alpha = 1 implies full opacity at a pixel– alpha = 0 implies completely clear pixels
• Images are now in RGBA format, and typically 32 bits per pixel (8 bits for alpha)
• All images in the project are in this format
![Page 44: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/44.jpg)
Pre-Multiplied Alpha• Instead of storing (R,G,B,), store (R,G,B,)• The compositing operations in the next several
slides are easier with pre-multiplied alpha• To display and do color conversions, must
extract RGB by dividing out – =0 is always black– Some loss of precision as gets small, but generally
not a big problem
![Page 45: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/45.jpg)
Why do we need pre-multiplied alpha?
gffo ccc )1(1
gfff
o
RR
c
)1(
“Over” Operator
1g
g
g
g B
G
R
c
f
f
f
f
f B
G
R
c
![Page 46: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/46.jpg)
Why do we need pre-multiplied alpha?
gffo ccc )1(1
gfff
gfff
gfff
o BB
GG
RR
c)1(
)1(
)1(
“Over” Operator
1g
g
g
g B
G
R
c
f
f
f
f
f B
G
R
c
![Page 47: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/47.jpg)
Why do we need pre-multiplied alpha?
gffo ccc )1(1
1
)1(
)1(
)1(
gfff
gfff
gfff
o BB
GG
RR
c
“Over” Operator
1g
g
g
g B
G
R
c
f
f
f
f
f B
G
R
c
![Page 48: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/48.jpg)
Why do we need pre-multiplied alpha?
gffo ccc )1(1
1
)1(
)1(
)1(
gfff
gfff
gfff
o BB
GG
RR
c
“Over” Operator
g
g
g
g
g B
G
R
c
f
f
f
f
g B
G
R
c
![Page 49: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/49.jpg)
Why do we need pre-multiplied alpha?
gffo ccc )1(1
ggfff
ggfff
ggfff
o BB
GG
RR
c
)1(
)1(
)1(
“Over” Operator
g
g
g
g
g B
G
R
c
f
f
f
f
g B
G
R
c
![Page 50: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/50.jpg)
Why do we need pre-multiplied alpha?
gffo ccc )1(1
gff
ggfff
ggfff
ggfff
o BB
GG
RR
c
)1(
)1(
)1(
)1(
“Over” Operator
g
g
g
g
g B
G
R
c
f
f
f
f
g B
G
R
c
g
gg
gg
gg
f
f
ff
ff
ff
B
G
R
B
G
R
)1(
![Page 51: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/51.jpg)
Basic Compositing Operation• At each pixel, combine the pixel data from f and
the pixel data from g with the equation:
gffo ccc )1(1
],,,[ ffffffff BGRc
],,,[ gggggggg BGRc
“Over” Operator
![Page 52: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/52.jpg)
• Changing pixel values
• Moving pixels around
Image Manipulation
hf
g
h([x,y])=[x,y/2]
![Page 53: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/53.jpg)
Parametric (global) warping
translation rotation aspect
affineperspective
cylindrical
Examples of parametric warps:
![Page 54: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/54.jpg)
Application of Image Warp
Creating virtual wide-angle camera
Mosaics: stitching images together
![Page 55: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/55.jpg)
Application of Image Warp
Creating realistic surface appearance
Texture mapping
http://www.futuretech.blinkenlights.nl/tex.html
![Page 56: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/56.jpg)
Application of Image Warp• Morphing
morphingimage #1 image #2
![Page 57: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/57.jpg)
Parametric (global) warping
• Transformation T is a coordinate-changing machine: p’ = T(p)
• What does it mean that T is global?– can be described by just a few numbers (parameters)– the parameters are the same for any point p
• Represent T as a matrix: p’ = Mp
T
p = (x,y) p’ = (x’,y’)
y
x
y
xM
'
'
h([x,y])=[x,y/2]
![Page 58: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/58.jpg)
Scaling• Scaling a coordinate means multiplying each of
its components by a scalar• Uniform scaling means this scalar is the same for
all components:
2
f g
y
x
y
x
2
2
'
'
y
x
![Page 59: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/59.jpg)
• Non-uniform scaling: different scalars per component:
Scaling
x 2,y 0.5
y
x
y
x
5.0
2
'
'
![Page 60: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/60.jpg)
Scaling
• Scaling operation:
• Or, in matrix form:
byy
axx
'
'
y
x
b
a
y
x
0
0
'
'
scaling matrix S
What’s inverse of S?
b
aS
/10
0/11
![Page 61: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/61.jpg)
2-D Rotation
(x, y)
(x’, y’)
x’ = x cos() - y sin()y’ = x sin() + y cos()
![Page 62: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/62.jpg)
2-D Rotation• This is easy to capture in matrix form:
• How can I remember this? • Even though sin() and cos() are nonlinear to ,
– x’ is a linear combination of x and y– y’ is a linear combination of x and y
• What is the inverse transformation?– Rotation by –– For rotation matrices, det(R) = 1
y
x
y
x
cossin
sincos
'
'
TRR 1
R
x’ = x cos() - y sin()y’ = x sin() + y cos()
![Page 63: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/63.jpg)
2x2 Matrices• What types of transformations can be
represented with a 2x2 matrix?
2D Identity?
yyxx
''
yx
yx
1001
''
2D Scale around (0,0)?
ysy
xsx
y
x
*'
*'
y
x
s
s
y
x
y
x
0
0
'
'
![Page 64: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/64.jpg)
2x2 Matrices• What types of transformations can be
represented with a 2x2 matrix?
2D Rotate around (0,0)?
yxy
yxx
*cos*sin'
*sin*cos'
y
x
y
x
cossin
sincos
'
'
2D Shear?
yxshy
yshxx
y
x
*'
*'
y
x
sh
sh
y
x
y
x
1
1
'
'
![Page 65: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/65.jpg)
• What types of transformations can be represented with a 2x2 matrix?
2x2 Matrices
2D Shear?
yxshy
yshxx
y
x
*'
*'
y
x
sh
sh
y
x
y
x
1
1
'
'
(1,1)
1
1
0 x
y
1
1
0 x’
y’
shy
shx
![Page 66: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/66.jpg)
2x2 Matrices• What types of transformations can be
represented with a 2x2 matrix?
2D Mirror about Y axis?
yyxx
''
yx
yx
1001
''
2D Mirror over (0,0)?
yyxx
''
yx
yx
1001
''
![Page 67: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/67.jpg)
• Linear transformations are combinations of …– Scale,– Rotation,– Shear, and– Mirror
• Any 2D transform can be decomposed into the product of a rotation, scale, and a rotation
All 2D Linear Transformations
y
x
dc
ba
y
x
'
'
)3.58()618.0,618.1()7.31(10
11
rotatescalerotate
![Page 68: CS559: Computer Graphics Lecture 6: Edge Detection, Image Compositing, and Warping Li Zhang Spring 2010.](https://reader036.fdocuments.in/reader036/viewer/2022062806/56649e7e5503460f94b81b6e/html5/thumbnails/68.jpg)
• Linear transformations are combinations of …– Scale,– Rotation,– Shear, and– Mirror
• A symmetric 2D transform can be decomposed into the product of a rotation, scale, and the inverse rotation
All 2D Linear Transformations
y
x
dc
ba
y
x
'
'
)7.31()382.0,618.2()7.31(11
12
rotatescalerotate