Image Filter Convolution Code

Image filter convolution matlab code

 

close all;

x=imread(‘cameraman.jpg’); % ——–filter coeff.———–%

f11=[1 1 1;1 1 1;1 1 1];

f12=[1 0 -1;1 0 -1;1 0 -1];

f13=[1 1 1;0 0 0;-1 -1 -1];

f11

f12

f13% ——-filtering———–%

x1=x(1:256,1:256);

y1=conv2(x1,f11);

y2=conv2(x1,f12);

y3=conv2(x1,f13);

subplot(2,2,1);
imshow(x);
title(‘IMAGE ‘)

subplot(2,2,2);
imshow(uint8((y1)));
title(‘f1- IMAGE ‘)

subplot(2,2,3);
imshow(uint8((y2)));
title(‘f2- IMAGE ‘)

subplot(2,2,4);
imshow(uint8((y3)));
title(‘f3-IMAGE ‘)

button_download-code