-
Notifications
You must be signed in to change notification settings - Fork 0
/
Roundness.m
49 lines (40 loc) · 1.15 KB
/
Roundness.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
Ax12 = axes ;
hold(Ax12,'on')
[~,Lab,~,~] = bwboundaries(BW) ;
bw = Lab == 1 ;
imshow(bw,'Parent',Ax12)
%%
% out = corner(bw,'QualityLevel',0.1) ;
% Corner_2D = cornermetric(bw) ;
% Corner_Loc = imregionalmax(Corner_2D) ;
% [A B] = find(Corner_Loc == true) ;
% out(:,2) = A ; out(:,1) = B ;
% Out = detectHarrisFeatures(bw,'MinQuality',0.37) ;
% out = double(Out.Location) ;
% Out = detectMinEigenFeatures(bw,'MinQuality',0.37) ;
% out = double(Out.Location) ;
out = cornerMyMethod(bw) ;
XCON = out(:,1) ;
YCON = out(:,2) ;
plot(Ax12,XCON,YCON,'*b')
%% With Clustering
% run('With_Clustering_Roundness')
%% Without Clustering
run('Without_Clustering_Roundness')
%% Show
Theta = 0:0.01:2*pi ;
for i = 1:length(r)
xcirc = xcent(i) + r(i)*cos(Theta) ;
ycirc = ycent(i) + r(i)*sin(Theta) ;
plot(Ax12,xcirc,ycirc,'g','LineWidth',1.5) ;
end
%% MIC - 2Tip
run('MIC_withCentroid')
% run('MIC_withSkeleton')
%% Show
Theta = 0:0.01:2*pi ;
xcircMIC = XMIC + RMIC*cos(Theta) ;
ycircMIC = YMIC + RMIC*sin(Theta) ;
plot(Ax12,xcircMIC,ycircMIC,'b','LineWidth',2) ;
%% Result
RoundnessFactor = sum(r)/(length(r)*RMIC)