显示彩色图像低通滤波的效果

%function 显示彩色图像低通滤波的效果%
clear all;
 RGB = imread('pears.png');
 subplot(121),imshow(RGB),title('orignal');
 for i = 1:3
     A = RGB(:, :, i);
     [hang,col] = size(A);
    % I = zeros(hang,col,3);
     for j = 1:hang
         B = A(j,:);
         C = double(B);
         [M ,N] = butter(8,0.5);  %butterworth 滤波器,四种均可,用低通,8表示阶数,
                                  % 0.5表示截至频率,即滤波幅值响应为sqrt(1/2),
                                  %必须在0-1之间取,1即Nyquist 频率,越小滤波效果越明显%
                               
         D = filter(M,N,C);
         A(j,:) = D;
     end
     RGB(:,:,i) =A;
 end
 %J = uint8(I);
%
subplot(122),imshow(RGB),title('butter image');%显示图有黑边%

你可能感兴趣的:(显示彩色图像低通滤波的效果)