All pastes #1985187 Raw Edit

Miscellany

public text v1 · immutable
#1985187 ·published 2010-11-08 10:37 UTC
rendered paste body
image = imread('boot.tif');

% Gewichtsfkt. fuer REDUCE
B8 = 1/256 * [1 8 28 56 70 56 28 8 1];
w = B8' * B8;

% Initialisieren der Gauss-Pyramide
gauss = zeros(size(image,1), size(image,2),6);
gauss(:,:,1) = image;

% REDUCE
for k=2:6
    height = size(image,1)/(2^(k-1));
    width = size(image,2)/(2^(k-1));
    for i=1:height
        for j=1:width
            for m=-4:4
                for n=-4:4
                    if (2*i+m > 0 && 2*j+n > 0 && 2*i+m <= height*2 && 2*j+n <= width*2)
                        gauss(i,j,k) = gauss(i,j,k) + w(5+m,5+n) * gauss(2*i+m,2*j+n,k-1);
                    end
                end
            end
            gauss(i,j,k) = floor(gauss(i,j,k));
        end
    end
end

% Konstruktion der Laplace-Pyramide
% Initialisieren der Laplace-Pyramide
laplace = zeros(size(image,1), size(image,2),6);
laplace(:,:,6) = gauss(:,:,6);

% EXPAND
for k=5:-1:1
    height = size(image,1)/(2^(k-1));
    width = size(image,2)/(2^(k-1));

    gauss_ex = gaussExpand(gauss(1:uint8(height/2),1:uint8(width/2),k+1));
    
    laplace(1:height,1:width,k) = gauss_ex - gauss(1:height,1:width,k);
end