do gaussian filtering to an image ,but it shows dark

4 visualizaciones (últimos 30 días)
Roger
Roger el 10 de Ag. de 2014
Comentada: Image Analyst el 22 de Jun. de 2020
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);

Respuesta aceptada

Image Analyst
Image Analyst el 10 de Ag. de 2014
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.
  5 comentarios
Winston
Winston el 22 de Jun. de 2020
Hi, when I filter the image, it shows different contrast comparing witht the orginal, any method that can adjusted filtered image to show the similar or same contrast with the orginal?
orginal=openfig('f.fig');
f=getimage;
g=imadjust(imfilter(f,fspecial('unsharp'),0.2), [], [], 0.5);
figure,
imshow(g,[]), colormap gray;
title('Sharpened image');
Image Analyst
Image Analyst el 22 de Jun. de 2020
Yes, just don't call imadjust() to change the contrast.

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by