CS 395: Adv. Computer CS 395: Adv. Computer Graphics Graphics Introduction to Introduction to Image-Space Image-Space Methods Methods Watt & Watt: Chapter 8, Watt & Watt: Chapter 8, "Pixel is Not a Little Square!" –AR Smith "Pixel is Not a Little Square!" –AR Smith Jack Tumblin Jack Tumblin [email protected][email protected]
40
Embed
CS 395: Adv. Computer Graphics Introduction to Image-Space Methods Image-Space Methods Watt & Watt: Chapter 8, "Pixel is Not a Little Square!" –AR Smith.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
– Combine:Combine: +/-*, Compositing, (depth images?) +/-*, Compositing, (depth images?)– Separate:Separate: matte or ‘segmenting’ matte or ‘segmenting’– Elaborate:Elaborate: make ‘more of the same’ picture make ‘more of the same’ picture
• 3D3D2D Light Intensity Map 2D Light Intensity Map I(I(x,yx,y))• Angle(Angle(,,) ) Position( Position(x,yx,y) ) • ‘‘BlurringBlurring’—sharpness set by focus, lens quality’—sharpness set by focus, lens quality
I(I(x,yx,y))Image Plane Image Plane
IntensityIntensity
Ang
le(
Ang
le(
,, ))
Pos
ition
(P
ositi
on( x
,yx,y ))
Viewed SceneViewed Scene
‘‘Digital’ Images: 2D Grid of NumbersDigital’ Images: 2D Grid of Numbers
• NO intrinsic meaning, but ...NO intrinsic meaning, but ...• Widely assumed to representWidely assumed to represent
– Point Samples of a “smoothed” 2D intensity surfacePoint Samples of a “smoothed” 2D intensity surface– Uniform sampling pattern (but not always)Uniform sampling pattern (but not always)
• Digital Image == 2D grid of numbers: I(m,n)Digital Image == 2D grid of numbers: I(m,n)
I(x,y)I(x,y)
x,yx,y
I(m,n)I(m,n)
m,nm,n
(pixels)(pixels)
Digital Images As VectorsDigital Images As Vectors
• ‘‘Stack up’ pixel values: VERY LONG vector Stack up’ pixel values: VERY LONG vector – 1 digital image == 1 point in N-dim. Space1 digital image == 1 point in N-dim. Space– Nearby points == Similar imagesNearby points == Similar images– All possible digital images: All possible digital images:
a grid of N-D pointsa grid of N-D points
– Space of all practical Space of all practical digital images: digital images:
Digital Images As VectorsDigital Images As Vectors
Exploration of the space-of-all-images:Exploration of the space-of-all-images:• Image shift, scale, rotation, warp, etc.Image shift, scale, rotation, warp, etc.
as vector operation? awkward...as vector operation? awkward...• ‘‘Video Textures’ (Schodl et al., SIGG2000)Video Textures’ (Schodl et al., SIGG2000)
– for each pixel, for each pixel, make a vector of neighborhood pixel values:make a vector of neighborhood pixel values:
– Make a ‘dictionary’ of these vectors:Make a ‘dictionary’ of these vectors:given a vector , given a vector ,
– what are the most likely values of ?what are the most likely values of ?
Dictionary: crude, local pattern learningDictionary: crude, local pattern learning– Use dictionary to build a new image from Use dictionary to build a new image from
‘seed’ pixels/regions chosen at random.‘seed’ pixels/regions chosen at random.
• Given images A,B,C, ‘learn’ AGiven images A,B,C, ‘learn’ AB mapping. then find DB mapping. then find DSolves ‘A is to B’ as ‘C is to D’ problemsSolves ‘A is to B’ as ‘C is to D’ problems
• Recreates some local effects—brush strokes, blur, etc.Recreates some local effects—brush strokes, blur, etc.• Wider variety of user-guided reconstruction..Wider variety of user-guided reconstruction..
– Recent extensions: Recent extensions: video textures, depth, curves, shapes, video textures, depth, curves, shapes, textures on surfaces, colorizing B/W textures on surfaces, colorizing B/W
iteratively compute new pixel intensity from iteratively compute new pixel intensity from neighbors + rules. Image evolves over timeneighbors + rules. Image evolves over time
• Digital Image == 2D grid of numbers: I(m,n)Digital Image == 2D grid of numbers: I(m,n)
I(x,y)I(x,y)
x,yx,y
??
I(m,n)I(m,n)
m,nm,n
Digital Digital Real : ‘Reconstruction’ Real : ‘Reconstruction’
A pixel sets strength of a real A pixel sets strength of a real Basis functionBasis function(aka ‘reconstruction filter’s impulse (aka ‘reconstruction filter’s impulse
response’)response’)
I(m,n)I(m,n)
m,nm,n
00 0.50.5-0.5-0.5
1.01.0 I(x,y)I(x,y)
x,yx,y
‘‘Box’Box’
Digital Digital Real : ‘Reconstruction’ Real : ‘Reconstruction’
A pixel sets strength of a real A pixel sets strength of a real Basis functionBasis function(aka ‘reconstruction filter’s impulse (aka ‘reconstruction filter’s impulse
response’)response’)
I(m,n)I(m,n)
m,nm,n
00 1.01.0-1.0-1.0
1.01.0 I(x,y)I(x,y)
x,yx,y
‘‘Linear’Linear’
Digital Digital Real : ‘Reconstruction’ Real : ‘Reconstruction’
A pixel sets strength of a real A pixel sets strength of a real Basis functionBasis function(aka ‘reconstruction filter’s impulse (aka ‘reconstruction filter’s impulse
response’)response’)
I(m,n)I(m,n)
m,nm,n
00 1.01.0-1.0-1.0
1.01.0I(x,y)I(x,y)
x,yx,y
2.02.0
‘‘Cubic’Cubic’
RealRealDigital: ‘Sampling’Digital: ‘Sampling’
• If I(x,y) is ‘smooth enough’ already,If I(x,y) is ‘smooth enough’ already,
• ?Why not just grab I(x,y) values at (m,n) ??Why not just grab I(x,y) values at (m,n) ?
I(x,y)I(x,y)
x,yx,y
I(m,n)I(m,n)
m,nm,n
‘‘Smooth enough’ to Sample?Smooth enough’ to Sample?
• Because ‘smooth enough’ is Because ‘smooth enough’ is undefinedundefined;;
• Samples may hit spurious peaks, valleysSamples may hit spurious peaks, valleys
I(x,y)I(x,y)
x,yx,y
I(m,n)I(m,n)
m,nm,n
BAD!BAD!
Real Real Digital : ‘Pre-filter’ Digital : ‘Pre-filter’
‘‘Smoothing’ Defined : Linear Pre-filterSmoothing’ Defined : Linear Pre-filter
Pixel = Pixel = local weighted averagelocal weighted average of real image of real imagearound pixel sample pointaround pixel sample point
I(x,y)I(x,y)
x,yx,y
m,nm,n
00 1.01.0-1.0-1.0
1.01.0
2.02.0
‘‘Cubic’Cubic’weightsweights
WeightWeight1.01.0
Pre-Filter functionsPre-Filter functions
• Pre-filters == anti-aliasingPre-filters == anti-aliasing in Comp Graphics in Comp Graphics
• Sine wave magic:Sine wave magic:1)1) ALLALL (continuous)(continuous) functionsfunctions are a are a (possibly infinite)(possibly infinite)
weighted sum of sinusoids: weighted sum of sinusoids: f(x) = Af(x) = A00sin(wsin(w00x) + Bx) + B00cos(wcos(w00x)+x)+
A A11sin(wsin(w11x) + Bx) + B11cos(wcos(w00x)+…x)+…
2)2) ForFor ALL ALL FILTERS FILTERS (box, linear, cubic,…, anything…)(box, linear, cubic,…, anything…)
sinusoid in sinusoid in scaled, shifted sinusoid out scaled, shifted sinusoid out
THUS– compute response to ALL signals from sinusoids THUS– compute response to ALL signals from sinusoids
3)3) High-Frequency Sinusoids in a signal hold High-Frequency Sinusoids in a signal hold ALLALL of its sampling/aliasing troubles! of its sampling/aliasing troubles!
1-D Aliasing Example1-D Aliasing Example
Real image:Real image: I(x,y) =sin(2 I(x,y) =sin(2fx) f=3.0fx) f=3.0
Real
Aliasing: Aliasing: when bad conversionwhen bad conversion
scrambles the frequenciesscrambles the frequenciesof sinusoidsof sinusoids
1-D Aliasing Example1-D Aliasing Example
Real image:Real image: I(x,y) =sin(2 I(x,y) =sin(2fx) f=3.0fx) f=3.0
Sample at: Sample at: x(n) = n / 36.0 (~12 samples per cycle)x(n) = n / 36.0 (~12 samples per cycle)
Sample
Real
Aliasing ExampleAliasing Example
Real image:Real image: I(x,y) =sin(2 I(x,y) =sin(2fx) f=3.0fx) f=3.0
Sample at: Sample at: x(n) = n / 36.0 (~12 samples per cycle)x(n) = n / 36.0 (~12 samples per cycle)
? How much sampling is enough? ? How much sampling is enough?
• Depends on quality of Depends on quality of reconstructionreconstruction filter filter
• Rule-of-Thumb: at least 4 samples per cycle of the Rule-of-Thumb: at least 4 samples per cycle of the highest frequency sinusoidhighest frequency sinusoid
• Nyquist CriterionNyquist Criterion: 2 samples/cycle is theoretical min. : 2 samples/cycle is theoretical min.
Sample
Real
Display
SampleSample
Real
DisplayDisplay
Conclusion:Conclusion:
• Digital images are compact, indirect, Digital images are compact, indirect, ambiguous descriptions of light distributionsambiguous descriptions of light distributions
• Digital images are vectorsDigital images are vectors
• Digital image patterns can be learnedDigital image patterns can be learned
• Image-space manipulations must explicitly Image-space manipulations must explicitly address real-digital (discrete-continuous) address real-digital (discrete-continuous) conversions to avoid aliasing artifacts.conversions to avoid aliasing artifacts.
Aliasing ExampleAliasing Example
Real image:Real image: I(x,y) =sin(2 I(x,y) =sin(2fx) f=3.0fx) f=3.0
Sample at: Sample at: x(n) = n / 36.0 (~12 samples per cycle)x(n) = n / 36.0 (~12 samples per cycle)
• Intro: What can we do with images?Intro: What can we do with images?• Re-sampling:Continuous & Discrete FiltersRe-sampling:Continuous & Discrete Filters
– Interpolation: What’s ‘in-between’ a pixel?Interpolation: What’s ‘in-between’ a pixel?– Antialiasing: What makes a good sampling?Antialiasing: What makes a good sampling?– Math Rigor: the Fourier TransformMath Rigor: the Fourier Transform– Examples: box, triangle, Mitchell-NetravaliExamples: box, triangle, Mitchell-Netravali
• Compositing: TransparencyCompositing: Transparency• Un-Compositing: Matte SeparationsUn-Compositing: Matte Separations• Further extensions: Further extensions:
• ‘‘Image’Image’==A 2D map of light intensities from a lens==A 2D map of light intensities from a lens• ‘‘Digital Image’Digital Image’==a 2D grid of numbers (pixels)==a 2D grid of numbers (pixels)
• PROBLEMS: PROBLEMS: – What is What is betweenbetween all those points? all those points?– WhyWhy go digital? Why is it go digital? Why is it betterbetter than film? than film? – How can I combine the best of many pictures? Edit How can I combine the best of many pictures? Edit
easily?easily?
GOAL:GOAL:– More Flexibility; let me do more than just display!More Flexibility; let me do more than just display!
Image-Space TechniquesImage-Space Techniques
GOAL: More flexibility!GOAL: More flexibility!
• Compositing /Matte: cut-and-paste, Compositing /Matte: cut-and-paste, transparency , the ‘digital optical bench’ transparency , the ‘digital optical bench’ (Pixar`84)…(Pixar`84)…
• Warp: image as a ‘rubber sheet’, you can Warp: image as a ‘rubber sheet’, you can cut, stretch, and change at willcut, stretch, and change at will