clc;clear;close all;
I = imread('eight.tif');
h=zeros(5,5);
subplot(2,3,1),imshow (I)
H=fspecial('laplacian',0.2);
f=imfilter(I,H,'replicate');
subplot(2,3,2),imshow(f)
H2=[-1 0 -1;-1 4 -1 ;0 -1 0];
f2=imfilter(I,H2,'replicate');
subplot(2,3,3),imshow(f2)
H3=[1 0 1;1 -4 1 ;0 1 0];
f3=imfilter(I,H3,'replicate');
subplot(2,3,4),imshow(f3)
H4=[1 1 1;1 -8 1 ;1 1 1];
f4=imfilter(I,H4,'replicate');
subplot(2,3,5),imshow(f4)
H5=[-1 -1 -1;-1 8 -1 ;-1 -1 -1];
f5=imfilter(I,H5,'replicate');
subplot(2,3,6),imshow(f5)
قسمت دوم سوال:
figure(2)
subplot(1,5,1),imshow(I-f)
subplot(1,5,2),imshow(I-f2)
subplot(1,5,3),imshow(I-f3)
subplot(1,5,4),imshow(I-f4)
subplot(1,5,5),imshow(I-f5)