### MATLAB >> code for Gaussian Pyramid in matlab file

there is a code for Gaussian Pyramid in matlab file exchange. I want
to twst it but i do not understand what is input parameter. it is not
describe. Coulsd somebody tell be about Wt.
thanks

% Expand an image as per the Gaussian Pyramid.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function IResult = expand(I, Wt)

[h w]= size(I);

hnew = ceil(h * 2);
wnew = ceil(w * 2);

%% Pad the boundaries.

I = [ I(1,:) ; I ; I(h,:) ]; % Pad the top and bottom rows.
I = [ I(:,1) I I(:,w) ]; % Pad the left and right columns.

I = double(I);

IResult = zeros(hnew, wnew); % Initialize the array in the beginning
..
for i = 0 : hnew - 1
% fprintf('\n %d', i);
for j = 0 : wnew - 1
A = [];
for m = -2 : 2
for n = -2 : 2
pixeli = (i - m)/2 ;
pixelj = (j - n)/2 ;
if ( (floor(pixeli) == pixeli) & (floor(pixelj) ==
pixelj ) & pixeli >= 0 & pixelj >= 0 )
pixeli = pixeli + 1;
pixelj = pixelj + 1;
tmpval = I (pixeli, pixelj) * Wt(m + 3) * Wt(n +
3);
A = [A, tmpval] ;
end
end
end
IResult(i + 1, j + 1)= 4 * sum(A);
% Bad array arithmetic - Matlab array indices start at 1.
% and the algorithm assumes 0. Hence got to do it.
end
end

Similar Threads
```Hi,
I had posted code regarding Gaussian Pyramid 'Reduce' function in a
different thread previously.
I am posting herewith the code for 'Expand' function ! While this one
works, this one is terribly slow. Any tips /suggestions to improve the
same is most welcome.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Expand an image as per the Gaussian Pyramid.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function IResult = expand(I, Wt)

[h w]= size(I);

hnew = ceil(h * 2);
wnew = ceil(w * 2);

%% Pad the boundaries.

I = [ I(1,:) ;  I ;  I(h,:) ];  % Pad the top and bottom rows.
I = [ I(:,1)    I    I(:,w) ];  % Pad the left and right columns.

I = double(I);

IResult = zeros(hnew, wnew); % Initialize the array in the beginning ..
for i = 0 : hnew - 1
%   fprintf('\n %d', i);
for j = 0 : wnew - 1
A = [];
for m = -2 : 2
for n = -2 : 2
pixeli = (i - m)/2 ;
pixelj = (j - n)/2 ;
if ( \
(floor(pixeli) == pixeli) & (floor(pixelj) == pixelj )
& pixeli >= 0 & pixelj >= 0 )
pixeli = pixeli + 1;
pixelj = pixelj + 1;
tmpval =  I (pixeli, pixelj) * Wt(m + 3)
* Wt(n + 3);
A =  [A,  tmpval] ;
end
end
end
IResult(i + 1, j + 1)= 4 * sum(A);
% Bad array arithmetic - Matlab array indices start at 1.
% and the algorithm assumes 0. Hence got to do it.
end
end

--
Karthik.
Humans please 'removeme_' for my real email.
```

```I was wondering if there is  a subroutine in matlab image processing
library to get the Gaussian Pyramid image at different levels.

For example, something like a function with the following signature

Out = GaussPyramid(Input, Level)

where Input, stands for the original image
and Out stands for the Gaussian Pyramid image
and Level for the Pyramid Level ( Higher the level number, lower the
resolution of the image).
Thanks for any pointers in this regard.

--
Karthik.
Humans please 'removeme_' for my real email.
```

```hai
i want to use the center-surround technique for target detection. in order to calculate the center-surround difference, intially i have calculated gaussian pyramid then i have applied LOG filter. now i want to normalize the images in each level of the pyramid.
can any one explain me how to normalize these images?
```

```Hi anybdy have any idea how can a baseband audio sound can be supressed
or jammed using a white gaussian noise and how the result can be shown
in Matlab. any help will be appreciated. -Shruti

```