clear all

X = double(imread( 'lenna256.jpg' ));
whos

sm3 = (1/9) * [1 1 1; 1 1 1; 1 1 1]
sm5 = (1/25) * [1 1 1 1 1; 1 1 1 1 1; 1 1 1 1 1; 1 1 1 1 1; 1 1 1 1 1]
sh3 = (1/9) * [1 1 1; 1 -8 1; 1 1 1]
sh5 = (1/25) * [1 1 1 1 1; 1 1 1 1 1; 1 1 -24 1 1; 1 1 1 1 1; 1 1 1 1 1]

Ysm3 = imfilter(X,sm3);
Ysm5 = imfilter(X,sm5);
Ysh3 = imfilter(X,sh3);
Ysh5 = imfilter(X,sh5);

Zsh3 = X - Ysh3;
Zsh5 = X - Ysh5;

imagesc( X )
colormap( gray ( 256 ) )
axis image
imagesc( Ysm3 )
colormap( gray ( 256 ) )
axis image
imagesc( Ysm5 )
colormap( gray ( 256 ) )
axis image
imagesc( Ysh3 )
colormap( gray ( 256 ) )
axis image

imagesc( Ysh5 )
colormap( gray ( 256 ) )
axis image
imagesc( Zsh3 )
colormap( gray ( 256 ) )
axis image

imagesc( Zsh5 )
colormap( gray ( 256 ) )
axis image