-
Notifications
You must be signed in to change notification settings - Fork 0
/
Mymainyiq.m
39 lines (39 loc) · 1.25 KB
/
Mymainyiq.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
clc;clear;
% channels-adding noise-median smooth-unsharp mask-proposed filter-morphology
I=imread('c:\brain\4.jpg');
% [finr fing finb K]=Finalresyiq(I);
%
mean=0;
variance=0.01;
noisedensity=0.1;
specklevariance=0.01;
figure;
gaussiannoise = imnoise(I,'gaussian',mean,variance);
[finr fing finb K]=Finalresyiq(gaussiannoise); Kgauss=K;
figure;
saltynoise = imnoise(I,'salt & pepper',noisedensity);
[finr fing finb K]=Finalresyiq(saltynoise);Ksalt=K;
figure;
poissonnoise = imnoise(I,'poisson');
[finr fing finb K]=Finalresyiq(poissonnoise);Kpoisson=K;
figure;
specklenoise = imnoise(I,'speckle',specklevariance);
[finr fing finb K]=Finalresyiq(specklenoise);Kspeckle=K;
%% morphology
%imerode
se = strel('disk',1);
Kgaussmorph = imerode(Kgauss,se);
Ksaltmorph = imerode(Ksalt,se);
Kpoissonmorph = imerode(Kpoisson,se);subimage(Kpoissonmorph);
Kspecklemorph = imerode(Kspeckle,se);
%imclose
se = strel('disk',1);
Kgaussclose = imclose(Kgaussmorph,se);
Ksaltclose = imclose(Ksaltmorph,se);
Kpoissonclose = imclose(Kpoissonmorph,se);subimage(Kpoissonclose);
Kspeckleclose = imclose(Kspecklemorph,se);
%% hit miss function
output1=hitmiss(Kgaussclose);
output2=hitmiss(Ksaltclose);
output3=hitmiss(Kpoissonclose);
output4=hitmiss(Kspeckleclose);