490 likes | 691 Views
Diffusion Curves. Dr. Scott Schaefer. Diffusion Curves. Vector graphics-based representation for 2D images Images are piecewise smooth with discontinuities represented as curves. Image taken from “Diffusion Curves: A Vector Representation for Smooth-Shaded Images”.
E N D
Diffusion Curves Dr. Scott Schaefer
Diffusion Curves • Vector graphics-based representation for 2D images • Images are piecewise smooth with discontinuities represented as curves Image taken from “Diffusion Curves: A Vector Representation for Smooth-Shaded Images”
Representation • Bezier curves represent discontinuities • Give each curve a color function on left/right side of curve • Original paper uses linear color change • Modification: Control points can have any color Image taken from “Diffusion Curves: A Vector Representation for Smooth-Shaded Images”
Image Construction Use curves as boundary constraints Find a harmonic function that interpolates those boundary constraints Image taken from “Diffusion Curves: A Vector Representation for Smooth-Shaded Images”
Implementation (Simplified) Define a left/right color for points Use a background color to represent no data (black) Draw curve as a polygon made of quads (thick) with smooth shading
Implementation (Simplified) • Colored pixels are constraints • Find a harmonic function satisfying constraints • Harmonic function has Laplacian zero everywhere
Implementation (Simplified) 1 0 0 -4 1 1 0 0 • Colored pixels are constraints • Find a harmonic function satisfying constraints • Harmonic function has Laplacian zero everywhere 1
Implementation (Simplified) 1 0 0 -4 1 1 0 0 • Colored pixels are constraints • Find a harmonic function satisfying constraints • Harmonic function has Laplacian zero everywhere • Each value is average of its neighbors 1
Implementation (Simplified) • Draw curves as quads • Read pixel buffer back from OpenGL • Repeat a lot • For all pixels whose initial value was black, replace with average color of its neighbors from previous iteration
Problem Final Result
Problem 100 Iterations
Problem 200 Iterations
Problem 400 Iterations
Problem 800 Iterations
Problem 1600 Iterations
Problem 6400 Iterations
Problem Infinity Iterations
Problem 256
Simple Multi-Grid • Create power of 2 down-sampled images • Average value of all non-black pixels • For each level, starting at second to last • Up-sample previous level • Copy pixel value to black high-res pixels (non-black pixels are constraints) • For some number of iterations • For each non-constrained pixel, replace with color of its neighbors from previous iteration
Example Original 512x512
Example Down-sampled 256x256
Example Down-sampled 128x128
Example Down-sampled 64x64
Example Down-sampled 32x32
Example Down-sampled 16x16
Example Down-sampled 8x8
Example Down-sampled 4x4
Example Down-sampled 2x2
Example Down-sampled 1x1
Example Up-sampled
Example Smoothed
Example Up-sampled
Example Smoothed
Example Up-sampled
Example Smoothed
Example Up-sampled
Example Smoothed
Example Up-sampled
Example Smoothed
Example Up-sampled
Example Smoothed
Example Up-sampled
Example Smoothed
Example Up-sampled
Example Smoothed
Example Up-sampled
Example Smoothed