Computational Photography
Si Lu
Spring 2018
http://web.cecs.pdx.edu/~lusi/CS510/CS510_Computati
- nal_Photography.htm
04/10/2018
Computational Photography Si Lu Spring 2018 - - PowerPoint PPT Presentation
Computational Photography Si Lu Spring 2018 http://web.cecs.pdx.edu/~lusi/CS510/CS510_Computati onal_Photography.htm 04/10/2018 Last Time o Digital Camera n History of Camera n Controlling Camera o Photography Concepts Today o Filters and its
Si Lu
Spring 2018
http://web.cecs.pdx.edu/~lusi/CS510/CS510_Computati
04/10/2018
n History of Camera n Controlling Camera
naïve denoising Gaussian blur better denoising edge-preserving filter noisy image
Slide credit: Sylvain Paris and Frédo Durand
Slide credit: D. Hoiem
0.92 0.93 0.94 0.97 0.62 0.37 0.85 0.97 0.93 0.92 0.99 0.95 0.89 0.82 0.89 0.56 0.31 0.75 0.92 0.81 0.95 0.91 0.89 0.72 0.51 0.55 0.51 0.42 0.57 0.41 0.49 0.91 0.92 0.96 0.95 0.88 0.94 0.56 0.46 0.91 0.87 0.90 0.97 0.95 0.71 0.81 0.81 0.87 0.57 0.37 0.80 0.88 0.89 0.79 0.85 0.49 0.62 0.60 0.58 0.50 0.60 0.58 0.50 0.61 0.45 0.33 0.86 0.84 0.74 0.58 0.51 0.39 0.73 0.92 0.91 0.49 0.74 0.96 0.67 0.54 0.85 0.48 0.37 0.88 0.90 0.94 0.82 0.93 0.69 0.49 0.56 0.66 0.43 0.42 0.77 0.73 0.71 0.90 0.99 0.79 0.73 0.90 0.67 0.33 0.61 0.69 0.79 0.73 0.93 0.97 0.91 0.94 0.89 0.49 0.41 0.78 0.78 0.77 0.89 0.99 0.93
Slide credit: D. Hoiem
Slide credit: C. Dyer
Slide credit: C. Dyer
R G B
Slide credit: D. Hoiem
neighborhood at each pixel position
“Window operator”
n Enhancing images
n Extracting information from images
n Detecting patterns
Source: D. Hoiem
Slide credit: C. Dyer
Source: http://lullaby.homepage.dk/diy-camera/bokeh.html
Bokeh: Blur in out-of-focus regions of image Camera shake
Source: Fergus, et al. “Removing Camera Shake from a Single Photograph”, SIGGRAPH 2006
Slide credit: C. Dyer
n g is called a filter, mask, kernel, or template
pixel position
and denoted h = f g
Slide credit: C. Dyer
1 1 1 1 1 1 1 1 1
] , [ g
Slide credit: David Lowe
90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90
Credit: S. Seitz
] , [ ] , [ ] , [
,
l n k m f l k g n m h
l k
1 1 1 1 1 1 1 1 1
] , [ g
90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 10 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90
1 1 1 1 1 1 1 1 1
] , [ g
] , [ ] , [ ] , [
,
l n k m f l k g n m h
l k
Credit: S. Seitz
90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 10 20 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90
1 1 1 1 1 1 1 1 1
] , [ g
Credit: S. Seitz
] , [ ] , [ ] , [
,
l n k m f l k g n m h
l k
90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 10 20 30 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90
1 1 1 1 1 1 1 1 1
] , [ g
] , [ ] , [ ] , [
,
l n k m f l k g n m h
l k
Credit: S. Seitz
10 20 30 30 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90
1 1 1 1 1 1 1 1 1
] , [ g
] , [ ] , [ ] , [
,
l n k m f l k g n m h
l k
Credit: S. Seitz
10 20 30 30 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90
1 1 1 1 1 1 1 1 1
] , [ g
?
] , [ ] , [ ] , [
,
l n k m f l k g n m h
l k
Credit: S. Seitz
10 20 30 30 50 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90
1 1 1 1 1 1 1 1 1
] , [ g
?
] , [ ] , [ ] , [
,
l n k m f l k g n m h
l k
Credit: S. Seitz
90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 10 20 30 30 30 20 10 20 40 60 60 60 40 20 30 60 90 90 90 60 30 30 50 80 80 90 60 30 30 50 80 80 90 60 30 20 30 50 50 60 40 20 10 20 30 30 30 30 20 10 10 10 10
1 1 1 1 1 1 1 1 1
] , [ g
] , [ ] , [ ] , [
,
l n k m f l k g n m h
l k
Credit: S. Seitz
What does it do?
an average of its neighborhood
effect (i.e., removes sharp features)
1 1 1 1 1 1 1 1 1
Slide credit: David Lowe
] , [ g
Slide credit: C. Dyer
n Values all positive n Sum to 1 constant regions same as input n Amount of smoothing proportional to mask size n Removes “high-frequency” components n “low-pass” filter
Slide credit: C. Dyer
then convolve each column of new image with same 1D kernel to yield output image
0.003 0.013 0.022 0.013 0.003 0.013 0.059 0.097 0.059 0.013 0.022 0.097 0.159 0.097 0.022 0.013 0.059 0.097 0.059 0.013 0.003 0.013 0.022 0.013 0.003
5 x 5, = 1
Slide credit: Christopher Rasmussen
actually doesn’t compare at all well with a defocused lens
that a single point of light viewed in a defocused lens looks like a fuzzy blob; but the averaging process would give a little square
rotationally symmetric)
model of a fuzzy blob
physical processes (the sum
Slide by D.A. Forsyth
Slide credit: C. Dyer
smoothed (5x5 Gaussian)
Slide credit: C. Dyer
input
Slide by S. Paris
box average
Slide by S. Paris
Gaussian blur
Slide by S. Paris
σ = 2 with 30 x 30 kernel σ = 5 with 30 x 30 kernel
Source: D. Hoiem
Slide credit: C. Dyer
for sigma=1:3:10 h = fspecial('gaussian‘, hsize, sigma);
imshow(out); pause; end
Parameter σ is the “scale” / “width” / “spread” of the Gaussian kernel, and controls the amount of smoothing
Slide credit: C. Dyer
= 30 pixels = 1 pixel = 5 pixels = 10 pixels
Slide credit: C. Dyer
σ = 5 with 10 x 10 kernel σ = 5 with 30 x 30 kernel
Slide credit: C. Dyer
Slide credit: C. Dyer
Original 1 1 1 1 1 1 1 1 1 2
(Note that filter sums to 1)
Source: D. Lowe
Original 1 1 1 1 1 1 1 1 1 1
(Note that filter sums to 1)
Source: D. Lowe
1
+
Original 1 1 1 1 1 1 1 1 1 2
subtracting a multiple of a blurred version
Source: D. Lowe
Source: D. Lowe
and g =
1 1
1 1 called a Laplacian mask
Original Filtered result
Slide credit: C. Dyer
1
2
1 Vertical Edge (absolute value)
Sobel
Slide credit: C. Dyer
1 2 1 Horizontal Edge (absolute value)
Sobel
Slide credit: C. Dyer
Gaussian Filter Laplacian Filter
Gaussian unit impulse Laplacian of Gaussian I1 I2 G1 (1-G2) I1 G1
https://www.youtube.com/watch?v=gfvMU36fgKw
Gaussian filtering results Winnemoller, H., XDoG: advanced image stylization with eXtended Difference-of-Gaussians NPAR 2011 Input XDoG Input XDoG
proposed to make a photo look like a painting
Painterly-Rendering with Brushes of Multiple Sizes
n Build painting one layer at a time, from biggest to smallest brushes n At each layer, add detail missing from previous layer
Slide credit: S. Chenney
function paint(sourceImage,R1 ... Rn) // take source and several brush sizes { canvas := a new constant color image // paint the canvas with decreasing sized brushes for each brush radius Ri, from largest to smallest do { // Apply Gaussian smoothing with a filter of size const * radius // Brush is intended to catch features at this scale referenceImage = sourceImage * G(fs Ri) // Paint a layer paintLayer(canvas, referenceImage, Ri) } return canvas }
Slide credit: S. Chenney
procedure paintLayer(canvas,referenceImage, R) // Add a layer of strokes { S := a new set of strokes, initially empty D := difference(canvas,referenceImage) // euclidean distance at every pixel for x=0 to imageWidth stepsize grid do // step in size that depends on brush radius for y=0 to imageHeight stepsize grid do { // sum the error near (x,y) M := the region (x-grid/2..x+grid/2, y-grid/2..y+grid/2) areaError := sum(Di,j for i,j in M) / grid2 if (areaError > T) then { // find the largest error point (x1,y1) := max Di,j in M s :=makeStroke(R,x1,y1,referenceImage) add s to S } } paint all strokes in S on the canvas, in random order }
Slide credit: S. Chenney
Original Biggest brush Medium brush added Finest brush added
Slide credit: S. Chenney
Slide credit: S. Chenney
naïve denoising Gaussian blur better denoising edge-preserving filter noisy image
Slide credit: Sylvain Paris and Frédo Durand
median value of its neighbors
introduced
for impulse, salt & pepper noise
Slide credit: C. Dyer
Salt and pepper noise Median filtered Plots of a row of the image Matlab: output im = medfilt2(im, [h w])
Slide credit: M. Hebert, C. Dyer
Slide credit: C. Dyer
Slide credit: C. Dyer
19x19 median filter
input
images by J. Plush Slide credit: C. Dyer
http://www.cse.ucsc.edu/~manduchi/Papers/I CCV98.pdf
n SUSAN filter [Smith and Brady 95] http://citeseer.ist.psu.edu/smith95susan.html n Digital-TV [Chan, Osher and Chen 2001] http://citeseer.ist.psu.edu/chan01digital.html n sigma filter http://www.geogr.ku.dk/CHIPS/Manual/f187.htm
Slide credit: F . Durand
input
Slide credit: F . Durand
input
x x x x
Slide credit: F . Durand
x
x
Slide credit: F . Durand
x
input
x x x x
[Tomasi and Manduchi 1998]
input
1 k(x)
x
g(I(x) I(x))
x x I(x)
Slide credit: F . Durand
input
1 k(x)
x
g(I(x) I(x))
x x x
Slide credit: F . Durand
[Tomasi and Manduchi 1998]
input
1 k(x)
x
x x I(x)
Slide credit: F . Durand
[Tomasi and Manduchi 1998]
input
1 k(x)
x
g(I(x) I(x))
x
g(I(x) I(x))
[Tomasi and Manduchi 1998]
Slide credit: F . Durand
input
Same Gaussian kernel everywhere.
Slide credit: P . Sylvain
input
The kernel shape depends on the image content.
Slide credit: P . Sylvain
s = 2 s = 6 s = 18 r = 0.1 r = 0.25 r =
(Gaussian blur)
input
Slide credit: P . Sylvain
Parameter for spatial distance Gaussian f Parameter for intensity difference Gaussian g
s = 2 s = 6 s = 18 r = 0.1 r = 0.25 r =
(Gaussian blur)
input
Slide credit: P . Sylvain
Parameter for spatial distance Gaussian f Parameter for intensity difference Gaussian g
Input Output Tomasi and Manduchi 1998
Slide credit: F . Durand
n Subsampling in space & range
n Limit to box kernel & intelligent maintenance of histogram
Slide credit: F . Durand
neighboring pixels
whole image
Buades, A., Coll, B., Morel, J.-M. A non-local algorithm for image denoising. CVPR 2005
weight of pixel j value at pixel j final value at pixel i
: patch centered at pixel i : patch centered at pixel j
Similar pixel neighborhoods give a large weight
Reprint from Buades et al. 2005
Input Gaussian Anisotropic Total variation Neighborhood NL-means
Reprint from Buades et al. 2005
n Fast non-local means algorithms available
n http://www.cs.tut.fi/~foi/GCF-BM3D/
domain collaborative filtering (TIP 2007)
n http://www.cs.tut.fi/~foi/GCF-BM3D/
An Analysis and Implementation of the BM3D Image Denoising Method
An Analysis and Implementation of the BM3D Image Denoising Method
. Bennett and L. McMillan. Video Enhancement using Per-pixel Virtual Exposures SIGGRAPH 2005
n Not edge-preserving n Motion blur
Reprint from [Bennett and McMillan 2005]
n Patch-based similarity measurement
n Prefer temporal neighbors
frame pt frame st
Reprint from [Bennett and McMillan 2005]
Reprint from [Bennett and McMillan 2005]
Input Naïve method ASTA
Reprint from [Bennett and McMillan 2005]