【问题标题】:Octave/Matlab High Boost filteringOctave/Matlab 高升压滤波
【发布时间】:2018-10-02 14:02:58
【问题描述】:

我必须在模糊步骤中使用高斯低通滤波器,然后我必须使用高增强滤波来提高结果的清晰度。 这是我到目前为止所拥有的:

I=imread('blurry-moon.tif');

A = fft2(double(I));
Ashift=fftshift(A);

[m n]=size(A); 
R=10; 
X=0:n-1;
Y=0:m-1;
[X Y]=meshgrid(X,Y);
Cx=0.5*n;
Cy=0.5*m;
LoF=exp(-((X-Cx).^2+(Y-Cy).^2)./(2*R).^2);

Gauss=Ashift.*LoF;
GaussShift=ifftshift(Gauss);
InverseGauss=ifft2(GaussShift);

%High boost
f = double(InverseGauss);
[m n]=size(f);
J0 = f;
for i=3:m-2
    for j=3:n-2
        J0(i,j) = (-8*f(i,j))+(1*f(i-1,j))+(1*f(i+1,j))+(1*f(i,j-1))+(1*f(i,j+1))...
    +(1*f(i-1,j-1))+(1*f(i+1,j+1))+(1*f(i-1,j+1))+(1*f(i+1,j-1)); 
    end
end

%----visualizing the results----------------------------------------------

figure(1)
imshow(I);colormap gray
title('original image','fontsize',14)

figure(2)
imshow(abs(Ashift),[-12 300000]), colormap gray
title('fft of original image','fontsize',14)


figure(3)
imshow(abs(InverseGauss),[12 290]), colormap gray
title('low pass filtered image','fontsize',14)

figure(4)
imshow(abs(J0),[12 290]), colormap gray
title('final image','fontsize',14)

我认为我在高升压中做错了什么。但我认为我正在做高斯滤波器,对吗? 有人可以帮忙解决一下高升压过滤器吗?

最好的问候!

【问题讨论】:

  • 哦,好吧,对不起,我忘了说我最后的高提升图像只有黑色。但它应该被锐化。
  • InverseGauss 正确吗?请省略正确的代码位,以便我们专注于不正确的位。发布Minimal, Complete and Verifiable Example (MCVE)
  • 我怀疑imshow(...,[12 290]) 是罪魁祸首,你应用了一个拉普拉斯滤波器,它返回正值和负值,并且由于之前的低通滤波,可能会有非常低的值。
  • 一个高通滤波器是img - Laplace(img),拉普拉斯本身就是一个高通滤波器。
  • 既然你已经有了,为什么不在傅里叶域中应用高提升权呢?会帮助你思考你在做什么,因为先抑制高频,然后再提升它们是没有意义的。

标签: matlab image-processing filtering octave gaussian


【解决方案1】:
img = imread('moon.tif');

% create gaussian filter
h = fspecial('gaussian',5,2.5);
% blur the image
blurred_img = imfilter(img,h);
% subtract blurred image from original
diff_img = img - blurred_img;
% add difference to the original image
highboost_img = img + 3*diff_img;

subplot 221
imshow(img,[]);
title('Original Image')

subplot 222
imshow(blurred_img,[]);
title('Blurred Image')

subplot 223
imshow(diff_img,[]);
title('Difference Image')

subplot 224
imshow(highboost_img,[]);
title('HighBoosted Image')

【讨论】:

    猜你喜欢
    • 2011-06-02
    • 1970-01-01
    • 2011-08-01
    • 2011-02-15
    • 2017-04-20
    • 2013-03-29
    • 1970-01-01
    • 2023-04-09
    • 1970-01-01
    相关资源
    最近更新 更多