Created
January 3, 2015 03:09
-
-
Save sherbondy/d443befd6bd30cb73804 to your computer and use it in GitHub Desktop.
Image Pyramid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# generates a lower level of the Gaussian pyramid decomposition of an image. | |
function impyramid(A; sizes="downsampled") | |
a = 0.375 | |
kernel = [1/4 - a/2, 1/4, a, 1/4, 1/4 - a/2] | |
B = imfilter(imfilter(A,kernel), kernel') # slowest part of impyramid, by far | |
if (sizes == "downsampled") | |
return (B[1:2:end, 1:2:end]) | |
elseif (sizes == "both") | |
return (B, B[1:2:end,1:2:end]) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment