【问题标题】:How can I use a linear filter from the frequency domain to remove noise in an image? [closed]如何使用频域中的线性滤波器去除图像中的噪声? [关闭]
【发布时间】:2019-12-30 22:54:46
【问题描述】:

所以我使用了空间域中的线性滤波器,但在频域中,我很难理解如何在 Matlab 中实现任何滤波器。谁能解释我该怎么做?

我想看看如何使用频域中的过滤器来去除图像中的噪声。

【问题讨论】:

    标签: matlab frequency-domain


    【解决方案1】:

    请参阅此登月图像示例。

    %=====================
    clc;
    clear all;
    close all;
    %=====================
    im = imread('moonlanding.png');
    %=====================
    FT  = fft2(double(im));
    %finding spectrum
    FTS = fftshift(FT);
    FTSG= log(FTS+1);
    figure;
    imshow(abs(FTSG),[]);
    %imtool(abs(FTS),[]);
    [m,n] = size(im);
    %====================
    t = 0:pi/10:2*pi;
    % point around which we filter image
    xc=(m+150)/2; 
    yc=(n-150)/2;
    %======================
    figure;
    subplot(221)
    imshow(im);
    %======================
    for k = 1:3
    %Radium of circular region of interest(for BRF)
    %r=200;   
    %r1 = 40;
    r = 200;
    r1 = 50*k;
    %------------------------
    xcc  = r*cos(t)+xc;
    ycc  = r*sin(t)+yc;
    xcc1 = r1*cos(t)+xc;
    ycc1 = r1*sin(t)+yc;
    %------------------------
    mask  = poly2mask(double(xcc),double(ycc), m,n);
    %generating mask for filtering
    mask1 = poly2mask(double(xcc1),double(ycc1), m,n);
    
    mask(mask1)=0;
    
    FT2=FTS;
    FT2(mask)=0;%cropping area or bandreject filtering
    %========================
    % Display Results
    %imtool(abs(FT2),[]);
    %subplot(211)
    %imshow(abs(FT2),[]);
    output = ifft2(ifftshift(FT2));
    subplot(2,2,(k+1));
    %imtool(output,[]);
    imshow(abs(output),[]);
    end
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-09-20
      • 2017-07-07
      • 2017-08-02
      • 2021-09-05
      • 2019-05-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多