Code covered by the BSD License  

Highlights from
Study of various Digital Image Processing concepts using MATLAB

image thumbnail

Study of various Digital Image Processing concepts using MATLAB

by

 

Study of various Digital Image Processing concepts using MATLAB. .txt files for C are also included

median3and5.m
clc;
clear all;
close all;
path='cktpepper.bmp';
I=imread(path);
H=I;
L=I;
x=imfinfo(path);
cols=x.Width;
rows=x.Height;

%% for 3x3 mask
for i=2:rows-1
    for j=2:cols-1
       G=zeros(3,3);
            for k=-1:1
            for l=-1:1
            G(k+2,l+2)=I(i+k,j+l);
            end
            end
G=reshape(G,9,1);
H(i,j)=median(G);
   
    end
end


%% for 5x5 mask
for i=3:rows-2
    for j=3:cols-2
        E=zeros(5,5);
            for k=-2:2
            for l=-2:2
                
           E(k+3,l+3)=I(i+k,j+l);
            end
            end
            E=reshape(E,25,1);
   L(i,j)=median(E);
    end
end

figure()
subplot(1,3,1)
imshow(I)
title('Input')
subplot(1,3,2)
imshow(H)
title('Median 3x3 mask')
subplot(1,3,3)
imshow(L)
title('Median 5x5 mask')

Contact us