function R = lapfilter_core(I,r)
G = gaussian_pyramid(I); compute input Gaussian pyramid
build up the re- sult, one Laplacian coefficient at a time
L = laplacian_ pyramid(zeros(size(I))); allocate space for result
tic;
for lev0 = 1:length(L)- 1
hw = 3* 2^lev0 - 2; half-width of full-res footprint
(conservative)
fprintf(‘level %d (%dx%d), footprint %dx%d ...
0%’,lev0,size(G{lev0}, 1),size(G{lev0}, 2),min( 2
*hw+ 1,size(I, 1)),min( 2*hw+ 1,size(I, 2)));
for y0 = 1:size(G{lev0}, 1)
for x0 = 1:size(G{lev0}, 2)
coords in full-res image corresponding
to (lev0,y0,x0)
yf = (y0-1)* 2^(lev0-1) + 1;
xf = (x0-1)* 2^(lev0-1) + 1;
subwindow in full-res image need-
ed to evaluate (lev0,y0,x0) in
result
yrng = [max( 1,yf-hw)
min(size(I, 1),yf+hw)];
xrng = [max( 1,xf-hw)
min(size(I, 2),xf+hw)];
Isub = I(yrng( 1):yrng( 2),x
rng( 1):xrng( 2),:);
use the corresponding
Gaussian pyramid coeffi-
cient to remap
the full-res subwindow
g0 = G{lev0}(y0,x0,:);
Iremap = r(Isub,g0);
compute Laplacian
pyramid for remapped
subwindow
Lremap = laplacian
pyramid(Iremap,
lev0+ 1,[yrng xrng]);
bookkeeping to compute
index of (lev0,y0,x0)
within the
subwindow, at full-res
and at current pyramid
level
yfc = yf - yrng( 1) + 1;
xfc = xf - xrng( 1) + 1;
yfclev0 = floor((yfc-
1)/2^(lev0-1)) + 1;
xfclev0 = floor((xfc-
1)/2^(lev0-1)) + 1;
set coefficient in result based
on the corresponding
coefficient in the remapped
pyramid
L{lev0}(y0,x0,:) = Lremap{lev0}
(yf clev0,xfclev0,:);
end
fprintf(‘\b\b\b\b%3d%%’,floor(y0/
size(G{lev0}, 1)*100));
end
fprintf(‘\n’);
end
L{end} = G{end}; resid- ual not affected
R = reconstruct_laplacian_pyramid(L); collapse result Laplacian pyramid
CACM.ACM.ORG 03/2015 VOL. 58 NO.03
Association for
Computing Machinery
Local
Laplacian
Filters
Edge-Aware
Image
Processing
with a
Laplacian
Pyramid
COMMUN ICAT I ONS
OF THEACM
Python for
Beginners
The Real
Who Owns IT?
Privacy Implications
of Health Information
Seeking on the Web