MATLAB: Do gaussian filtering to an image ,but it shows dark

gauss;filterimage processingImage Processing Toolbox

L00 ,L01 can show ,but L02,L03.L04 seems dark,what's wrong?
function sift_01()
clear;
%contruct scale space
I = imread('lena.jpg');
I0 = double(rgb2gray(I));
%[m,n]=size(I0);
sigma =1.6;
S=5;k=1/S;
L00 = Lspace(I0,sigma);
L01 = Lspace(I0,k*sigma);
L02 = Lspace(I0,k*k*sigma);
L03 = Lspace(I0,k^3*sigma);
L04 = Lspace(I0,k^4*sigma);
figure;
imshow(uint8(L00));
figure;
imshow(uint8(L01));
figure;
imshow(uint8(L02));
figure;
imshow(uint8(L03));
figure;
imshow(uint8(L04));
end
function L=Lspace(I0,sigma)
N=10;N1=(N+1)/2;
G = zeros(N,N);
for x = 1:N
for y = 1:N
G(x,y) = 1/(2*pi*sigma^2)*exp(-((x-N1)^2+(y-N1)^2)/(2*sigma^2));
end
end
L= conv2(I0,G);
function J=downsample(I)
J = I(1:2:end,1:2:end);

Best Answer

The numbers just get so small that they're less than 1 so when you uint8() them, they're zero. Even if you don't do that and view the floating point numbers, your G is essentially all zero as you move along. Print out G just before you exit the function to see how small it gets.
Related Question