Professional Documents
Culture Documents
Part 06
Part 06
photography
Ji Hui
Ji Hui (National University of Singapore) Visual Information Processing: Computational photography August 12, 2021 1 / 26
Gradient domain editing: Image blending
Ji Hui (National University of Singapore) Visual Information Processing: Computational photography August 12, 2021 2 / 26
Gradient domain editing: Image stitching
Ji Hui (National University of Singapore) Visual Information Processing: Computational photography August 12, 2021 3 / 26
Vector field and image gradient
Continues v.s. Discrete
Vector function : R2 ! R2 , each point associated w/. a vector
∂y
Image gradient G = [u, v]> = [Ix , Iy ]> = [ @x
@I @I >
, @y ]
Image
I(x,y)
Ix Iy
Ji Hui (National University of Singapore) Visual Information Processing: Computational photography August 12, 2021 4 / 26
Image gradient
Calculating image gradients rI:
@I
! [1, 1] ⌦ I
@x
@I
! [1, 1]> ⌦ I
@y
@u @v
=0
@y @x
since
@2I @2I
= .
@x@y @y@x
Ji Hui (National University of Singapore) Visual Information Processing: Computational photography August 12, 2021 5 / 26
Gradient domain editing
Why editing images in gradient domain, not directly copy-and-paste in
pixel domain Intuition – hole filling
Intuition: Continuity in brightness for brightness consistency when filling
hole
• 1D:
x1 x2
• 2D:
Ji Hui (National University of Singapore) Visual Information Processing: Computational photography August 12, 2021 6 / 26
Gradient domain
Seamlessly pasteediting onto
2D case
Ji Hui (National University of Singapore) Visual Information Processing: Computational photography August 12, 2021 7 / 26
Membrane Interpolation for filling hole
Ji Hui (National University of Singapore) Visual Information Processing: Computational photography August 12, 2021 8 / 26
Calculus of variation
when we minimize g(x) over R, we seek g 0 (x) = 0, and when we
minimize the objective over function, Variational method come to help.
Consider an integral of the form
Z
J(f ) = F (x, f, fx )dx,
⌦
Z
@F d @F
⌘(x)( )dx = 0, 8⌘.
@f dx @fx
Ji Hui (National University of Singapore) Visual Information Processing: Computational photography August 12, 2021 9 / 26
Euler-Lagrange equation for Membrane interpolation
In our case:
F = krf k22 = (fx2 + fy2 )
Then, we have
@F d @F d @F
=0
@f dx @fx dy @fy
The minimizer has zero Laplacian
@F @fx2 + fy2
= =0
@f @f
d @F d @(fx2 + fy2 ) d @2f
= = 2fx = 2 2
dx @fx dx @fx dx @x
2 2
d @F d @(f x + f y ) d @2f
= = 2fy = 2 2
dy @fx dy @fy dy @y
Then, we have
@2f @2f
f= + = 0.
@x2 @y 2
Ji Hui (National University of Singapore) Visual Information Processing: Computational photography August 12, 2021 10 / 26
Smooth hole filling
Minimizing ZZ
min krf k22 , f |@⌦ = f ⇤ |@⌦
f ⌦
The minimizer satifies
Ji Hui (National University of Singapore) Visual Information Processing: Computational photography August 12, 2021 11 / 26
Image editing in gradient domain
The discretization
@f @f
⇡ fx+1,y fx,y ⇡ fx,y+1 fx,y
@x @y
and
divG = ux,y ux 1,y + vx,y vx,y 1.
Ji Hui (National University of Singapore) Visual Information Processing: Computational photography August 12, 2021 13 / 26
Poisson editing
Ax = b.
Ji Hui (National University of Singapore) Visual Information Processing: Computational photography August 12, 2021 14 / 26
Another issue for image blending: blending boundary
Ji Hui (National University of Singapore) Visual Information Processing: Computational photography August 12, 2021 15 / 26
Seam Carving for minimizing boundary error
Intuition
Human vision more sensitive to edges – so try remove content from
smoother areas
Basic Idea: remove unimportant pixels from the image
For example, pixels with less magnitude
@f @f
E(rf (x, y)) = | |+| |
@x @y
Ji Hui (National University of Singapore) Visual Information Processing: Computational photography August 12, 2021 16 / 26
Finding seam: s⇤ = mins E(s)
Ji Hui (National University of Singapore) Visual Information Processing: Computational photography August 12, 2021 17 / 26
Poisson editing for image relighting
Consider a image g. let d denote desired brightness of pixel value at a
region ⌦, and rg desired image gradients different from rf .
Possion editing: Minimizing
ZZ
min krf rgk22 + µkf dk⌦
f
input relighting
Ji Hui (National University of Singapore) Visual Information Processing: Computational photography August 12, 2021 18 / 26
HDR imaging
Ji Hui (National University of Singapore) Visual Information Processing: Computational photography August 12, 2021 19 / 26
Dynamic range
Dynamic range
The ratio between the maximum (white) and minimum (black) measuable
light intensity
The real world is high dynamic range
about 5-10 million values to store all brightnesses in real world
typical camera provides limited dynamic range
typical 8-bit provide only 256 values
Ji Hui (National University of Singapore) Visual Information Processing: Computational photography August 12, 2021 20 / 26
Dynamic range and exposure
Over-exposure
over-exposure
Under-exposure
Under exposure
Ji Hui (National University of Singapore) Visual Information Processing: Computational photography August 12, 2021 21 / 26
Image photometric calibration
Photometric: How pixel values relate to radiance amounts in the world
Imaging system response function
g: log E ! Z,
Ji Hui (National University of Singapore) Visual Information Processing: Computational photography August 12, 2021 22 / 26
HDR imaging
Recovering full dynamic range of scene is all about g 1
.
Filling up the curve in g, via multiple exposures.
Finding the inverse of g which exists as g is monotonic and smooth.
Remark
Camera response function g is non-linear and unknown, its unique inverse
exists as g is monotonic and smooth for all cameras.
Ji Hui (National University of Singapore) Visual Information Processing: Computational photography August 12, 2021 23 / 26
HDR imaging via multiple exposure
Capture many images with different exposure settings.
Shutter speed, F/stop, ISO
Apply photometric calibration to each camera.
Combine the calibrated images, e.g., using averaging weighted by
exposures
Ji Hui (National University of Singapore) Visual Information Processing: Computational photography August 12, 2021 24 / 26
Mathematical formulation
Response function
Z = g(log E), E =R· t ! log E = log R + log( t),
where E denotes iradiance exposure and R denotes radiance.
Inverse response function
1
g (z) = log R + log( t)
Consider n images with different exposure time, we have
1
log Ri + log( tj ) = g (Zi,j ),
for i-th pixel in j-th image.
Solving the model with smooth contraint to estimate g 1
X zX
max
00
min k log Ri + log( tj ) g 1 (Zi,j )k22 + k(g 1
) (z)k22
i,j zmin
Ji Hui (National University of Singapore) Visual Information Processing: Computational photography August 12, 2021 26 / 26