-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathshili79.m
More file actions
72 lines (72 loc) · 1.96 KB
/
shili79.m
File metadata and controls
72 lines (72 loc) · 1.96 KB
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
h0=figure('toolbar','none',...
'position',[198 56 350 468],...
'name','实例79');
h1=axes('parent',h0,...
'position',[0.25 0.45 0.5 0.5],...
'visible','off');
load imdemos bacteria
imshow(bacteria)
k1=~(bacteria>100);
k2=filter2(fspecial('laplacian'),bacteria);
k3=(k2>-4)&k1;
k4=erode(k1)&(k3==0);
[r,c]=find(k4);
k5=bwselect(k1,c,r);
b1=uicontrol('parent',h0,...
'units','points',...
'tag','b1',...
'style','pushbutton',...
'string','二值分割图',...
'backgroundcolor',[0.75 0.75 0.75],...
'position',[30 110 50 20],...
'callback',[...
'cla,',...
'imshow(k1)']);
b2=uicontrol('parent',h0,...
'units','points',...
'tag','b2',...
'style','pushbutton',...
'string','滤波结果图',...
'backgroundcolor',[0.75 0.75 0.75],...
'position',[100 110 50 20],...
'callback',[...
'cla,',...
'imshow(k2)']);
b3=uicontrol('parent',h0,...
'units','points',...
'tag','b3',...
'style','pushbutton',...
'string','阈值化图',...
'backgroundcolor',[0.75 0.75 0.75],...
'position',[170 110 50 20],...
'callback',[...
'cla,',...
'imshow(k3)']);
b4=uicontrol('parent',h0,...
'units','points',...
'tag','b4',...
'style','pushbutton',...
'string','目标的核',...
'backgroundcolor',[0.75 0.75 0.75],...
'position',[30 60 50 20],...
'callback',[...
'cla,',...
'imshow(k4)']);
b5=uicontrol('parent',h0,...
'units','points',...
'tag','b5',...
'style','pushbutton',...
'string','目标分割图',...
'backgroundcolor',[0.75 0.75 0.75],...
'position',[100 60 50 20],...
'callback',[...
'cla,',...
'imshow(k5)']);
b6=uicontrol('parent',h0,...
'units','points',...
'tag','b6',...
'style','pushbutton',...
'string','关闭',...
'backgroundcolor',[0.75 0.75 0.75],...
'position',[170 60 50 20],...
'callback','close');