Skip to content

Instantly share code, notes, and snippets.

@sherbondy
Created January 3, 2015 03:10
Show Gist options
  • Save sherbondy/92e0fd4468f035c4140c to your computer and use it in GitHub Desktop.
Save sherbondy/92e0fd4468f035c4140c to your computer and use it in GitHub Desktop.
Reconstruct Laplacian Pyramid
# reconstruct an image (approximate, for the time being), from its pyramidal decomposition
function reconstruct(L)
im = last(L)
for n = (length(L)-1):-1:1
# upscale
im2 = zeros(2*size(im)[1], 2*size(im)[2])
im2[1:2:end,1:2:end, :] = im
# gaussian interpolation
kernel = [1/18, 1/2, 16/18, 1/2, 1/18];
im2 = imfilter(imfilter(im2, kernel, "reflect"), kernel', "reflect")
im = im2
im += L[n]
end
return im
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment