All pastes #1985188 Raw Edit

Miscellany

public text v1 · immutable
#1985188 ·published 2010-11-08 10:38 UTC
rendered paste body
function result = gaussExpand(input)

% Bildgroesse ermitteln
[height,width] = size(input);
% expandiertes Bild initialisieren
result = zeros(2*height,2*width);

% Gewichtsfunktion
B8 = 1/256 * [1 8 28 56 70 56 28 8 1];
w = B8' * B8;

% EXPAND
for i=1:2*height
    for j=1:2*width
        for m=-4:4
            for n=-4:4
                if (mod((i+m)/2,2) ~= 1 && mod((j+n)/2,2) ~= 1 && (i+m)/2 > 0 && (j+n)/2 > 0 && (i+m)/2 <= height && (j+n)/2 <= width)
                    result(i,j) = result(i,j) + w(5+m,5+n) * input(uint8((i+m)/2),uint8((j+n)/2));
                end
            end
        end
        result(i,j) = floor(4 * result(i,j));
    end
end

end