This repository has been archived on 2024-01-06. You can view files and clone it, but cannot push or open issues or pull requests.
justhomework/Matlab/dip/lab3/lab3_2.m

31 lines
800 B
Mathematica
Raw Normal View History

2022-11-21 03:42:00 +00:00
close all
clear
clc
disp('====E4_7_3.m====');
I=imread('PIC4.7.6a.bmp');
subplot(2,3,1),imshow(I),xlabel('(a)'),ylabel('');
K1=filter2(fspecial('average',3),I);
subplot(2,3,2),imshow(uint8(K1)),xlabel('(b)3*3');
mask=[0 0 0
0 1 1
0 1 1];
mask=(1/4)*mask;
K2=filter2(mask,I);
subplot(2,3,3),imshow(uint8(K2)),xlabel('(c)');
J=imnoise(I,'salt & pepper',0.4); % 1
subplot(2,3,4),imshow(J),xlabel('(a)'),ylabel('');
K3=filter2(fspecial('average',3),J);
subplot(2,3,5),imshow(uint8(K3)),xlabel('(b)3*3');
mask=[0 0 0
0 1 1
0 1 1];
mask=(1/4)*mask;
K4=filter2(mask,J);
subplot(2,3,6),imshow(uint8(K4)),xlabel('(c)');