advanced computer graphics (spring 2006) coms 4162, lecture 5: image processing 2: warping ravi...
Post on 20-Dec-2015
217 views
TRANSCRIPT
Advanced Computer Graphics Advanced Computer Graphics (Spring 2006) (Spring 2006)
COMS 4162, Lecture 5: Image Processing 2: Warping
Ravi Ramamoorthi
http://www.cs.columbia.edu/~cs4162
To Do To Do
Assignment 1, Due Feb 16. All info in this and previous lecture Enough to implement second half of assn
Questions/difficulties so far in doing assignment?
OutlineOutline
Image Warping General ideas Resampling filters Antialiased shift and resize
Not well covered in textbook
Many slides courtesy Tom Funkhouser
A note on notationA note on notation
This lecture uses (u,v) for warped location in the source image (or old coordinates) and (u', v') for integer coordinates, and (x,y) for new coordinates
Most of the homework assignment uses (x,y) for old integer coordinates and (a,b) for new coordinates. The warped location is not written explicitly, but is implicit in the evaluation of the filter f
Forward Warping: ProblemsForward Warping: Problems
Iterate over source, sending pixels to destination
Same source pixel may map to multiple dest pixels
Some dest pixels may have no corresponding source
Holes in reconstruction
Must splat etc.
Inverse Warping/MappingInverse Warping/Mapping
Iterate over dest, finding pixels from source
Non-integer evaluation source image, resample
May oversample source
But no holes
Simpler, better than forward mapping
OutlineOutline
Image Warping General ideas Resampling filters Antialiased shift and resize
Not well covered in textbook
Many slides courtesy Tom Funkhouser
Filtering or ResamplingFiltering or Resampling
Compute weighted sum of pixel neighborhood Weights are normalized values of kernel function Equivalent to convolution at samples with kernel Find good (normalized) filters h using ideas of last lecture
(u,v)width=2
s=0 ;for (u ' = u-width ; u ' <= u+width; u ' ++) for (v' = v-width ; v ' <= v+width; v ' ++) s += h (u ' - u, v' - v) src (u ' , v ') ;
Inverse Warping/MappingInverse Warping/Mapping
Iterate destination, finding pixels from source
Filter is really squarewith width w, not circle
A note on notationA note on notation
This lecture uses (u,v) for warped location in the source image (or old coordinates) and (u', v') for integer coordinates, and (x,y) for new coordinates
Most of the homework assignment uses (x,y) for old integer coordinates and (a,b) for new coordinates. The warped location is not written explicitly, but is implicit in the evaluation of the filter
This lecture uses h for filter (so as not to confuse with mapping f), while assignment uses f
Assignment has some notational misprints, corrected here.
Filters for AssignmentFilters for Assignment
Implement 3 filters Nearest neighbor or point sampling Hat filter (linear or triangle)
Mitchell cubic filter (form in assigments). This is a good finite filter that approximates ideal sinc but without ringing or infinite width. Alternative is gaussian
Construct 2D filters by multiplying 1D filters
( ) 1 | |h u u
( , ) ( ) ( )h u v h u h v
OutlineOutline
Image Warping General ideas Resampling filters Antialiased shift and resize
Not well covered in textbook
Many slides courtesy Tom Funkhouser
Antialiased ShiftAntialiased Shift
Shift image based on (fractional) sx and sy Check for integers, treat separately Otherwise convolve/resample with kernel/filter:
x yu x s v y s
', '
( , ) ( ' , ' ) ( ', ')u v
I x y h u u v v I u v
,
( , ) ( , ) ( , )x ynew oldx y
I a b f x a s y b s I x y
In notation of assignment (note slight misprint RHS should be (x,y))
Antialiased Scale MagnificationAntialiased Scale Magnification
Magnify image (scale s or γ > 1) [read s as γ in assn] Interpolate between orig. samples to evaluate frac vals Do so by convolving/resampling with kernel/filter: Treat the two image dimensions independently (diff scales)
xu
/ width
' / width
( ) ( ' ) ( ')u
u u
I x h u u I u
/ width
/ width
( ) ( ) ( )a
new oldx a
aI a f x I x
In notation of assignment
Antialiased Scale MinificationAntialiased Scale Minification
checkerboard.bmp 300x300: point sample checkerboard.bmp 300x300: Mitchell
Antialiased Scale MinificationAntialiased Scale Minification
Minify (reduce size of) image Similar in some ways to mipmapping for texture maps We use fat pixels of size 1/γ, with new size γ*orig size (γ is
scale factor < 1). Each fat pixel must integrate over corresponding region in
original image using the filter kernel.x
u
width/ width/
' width/ ' width/
( ) ( ( ' )) ( ') ( ' ) ( ')u u
u u u u
I x h u u I u h u x I u
( width)/
( width)/
( ) ( ) ( )a
new oldx a
I a f x a I x
In notation of assignment
Antialiased Scale MinificationAntialiased Scale Minification
Minify (reduce size of) image Similar in some ways to mipmapping for texture maps We use fat pixels of size 1/γ, with new size γ*orig size (γ is
scale factor < 1). Each fat pixel must integrate over corresponding region in
original image using the filter kernel.
Hence, filter width 1/ γ normal width Requires renormalization to work properly Caveats: floating point, parametric form for filter