-
Notifications
You must be signed in to change notification settings - Fork 1
/
Main.m
114 lines (99 loc) · 3.16 KB
/
Main.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
clc
clear all
close all
flag=0;
ID_im=5;
for i=1 : ID_im
flag=1;
switch i
case 1
img_orginal = imread('01.jpg') ;
img_orginal = double(rgb2gray(img_orginal));
c1 = -2;
phi = ones(size(img_orginal)).*c1;
phi(22:52,43:53) = -c1;
figure()
subplot(1,3,1)
imshow(img_orginal,[])
hold on
contour(phi,[0 0],'r','LineWidth',2)
itr = 4500;
landa = 0.99995;
sigma = 11;
phi = proposed_method( img_orginal,phi,itr,landa,sigma );
case 2
img_orginal = imread('02.jpg') ;
img_orginal = double(rgb2gray(img_orginal));
c1 = -2;
phi = ones(size(img_orginal)).*c1;
phi(55:65,50:55) = -c1;
itr = 1700;
figure()
subplot(1,3,1)
imshow(img_orginal,[])
hold on
contour(phi,[0 0],'r','LineWidth',2)
landa = 0.9995;
sigma = 4;
phi = proposed_method( img_orginal,phi,itr,landa,sigma );
case 3
img_orginal = imread('03.jpg') ;
img_orginal = double(rgb2gray(img_orginal));
c1 = -2;
phi = ones(size(img_orginal)).*c1;
phi(42:52,55:65) = -c1;
itr = 12000;
figure()
subplot(1,3,1)
imshow(img_orginal,[])
hold on
contour(phi,[0 0],'r','LineWidth',2)
landa = 1;
sigma = 4;
phi = proposed_method( img_orginal,phi,itr,landa,sigma );
case 4
img_orginal = imread('04.jpg');
img_orginal = double(rgb2gray(img_orginal));
c1=-2;
phi1 = ones(size(img_orginal)).*c1;
phi1(5:70,5:115) = -c1;
phi2 = ones(size(img_orginal)).*c1;
phi2(20:60,35:75) = -c1;
figure()
subplot(1,3,1)
imshow(img_orginal,[])
hold on
contour(phi1,[0 0],'b','LineWidth',2)
contour(phi2,[0 0],'r','LineWidth',2)
sigma = 14;
landa = 0.9995;
meu = 0.1;
itr = 600;
[phi1,phi2] = four_phase_formulation(img_orginal,phi1,phi2,itr,meu,landa,sigma);
flag=1;
case 5
img_orginal = imread('03.jpg') ;
itr=300;
sigma=4;
phi = selective_segmentation_model(img_orginal,itr,sigma);
end
if i==4
subplot(1,3,3)
imshow(img_orginal,[])
hold on
contour((phi1(:,:,1)),[0 0],'b','LineWidth',2)
contour((phi2(:,:,1)),[0 0],'r','LineWidth',2)
end
if i==5
subplot(1,2,2)
imshow(img_orginal,[])
hold on
contour((phi(:,:,1)),[0 0],'b','LineWidth',2)
end
if i==1 | i==2 | i==3
subplot(1,3,3)
imshow(img_orginal,[])
hold on
contour((phi(:,:,1)),[0 0],'b','LineWidth',2)
end
end