do gaussian filtering to an image ,but it shows dark

3 ビュー (過去 30 日間)
Roger
Roger 2014 年 8 月 10 日
コメント済み: Image Analyst 2020 年 6 月 22 日
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);

採用された回答

Image Analyst
Image Analyst 2014 年 8 月 10 日
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 件のコメント
Winston
Winston 2020 年 6 月 22 日
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 2020 年 6 月 22 日
Yes, just don't call imadjust() to change the contrast.

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by