Sunday, 10 April 2016


clc;clear all;close all;
% =========================================
%               Mean Filter
% =========================================
f = imread('saturn.tif');
subplot(2,2,1);
imshow(f);
title('Original Image');
m = mean2(double(f));
g = imfilter(f,m);
k = imabsdiff(f,g);
subplot(2,2,2);
imshow(g);
title('Mean Filtered Image');
subplot(2,2,3);
imshow(k);
title('Absolute Difference of f ang g');
% =========================================
%               Median filter
% =========================================
figure;
f = imread('saturn.tif');
g = imnoise(f,'salt & pepper',0.06);
subplot(1,2,1);
imshow(g);
title('Input Image');
%K = filter2(fspecial('average',3),g)/255;
M = medfilt2(g,[3 3]);
%figure, imshow(K)
subplot(1,2,2);
imshow(M);
title('Median filtered image');
% =========================================
%               Minimax filter
% =========================================
figure;
f = imread('saturn.tif');
subplot(1,2,1);
imshow(f);
title('Original Image');
n = 5;                  % Filter order
freq = [0 0.4 0.5 1];   % Frequency band edges
a = [1  1  0  0];       % Desired amplitudes
b = remez(n,freq,a);
L = imfilter(f,b);
subplot(1,2,2);
imshow(L);

title('Mini-max Filtered Image');

output
Mean
output
Median

output
Min-Max




Related Posts :



0 comments:

Confused? Feel free to ask

Post a Comment