Repository navigation
Expand file tree
/
Copy pathmain.py
More file actions
175 lines (128 loc) · 4.53 KB
/
Copy pathmain.py
File metadata and controls
175 lines (128 loc) · 4.53 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
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
from numpy import genfromtxt
from pylab import *
import glob
import os
import numpy
fast_seq1= []
brisk_seq1= []
gftt_seq1= []
harris_seq1= []
orb_seq1= []
sift_seq1= []
star_seq1= []
surf_seq1= []
fast_seq_mean = []
brisk_seq_mean =[]
gftt_seq_mean = []
harris_seq_mean = []
orb_seq_mean = []
sift_seq_mean = []
star_seq_mean = []
surf_seq_mean = []
seq_temp = numpy.zeros(114)
def plot_set(plot_data):
legend_labels = ("BRIEF", "BRISK", "FREAK", "ORB", "SIFT", "SURF")
for i in range (0, 6):
plot(plot_data[i][0:45], label=legend_labels[i]) # tu wystarczy zmienic przedzial, zeby narysowac odpowiednia czesc wykresu
def get_processing_time(dataset_path):
file_data = genfromtxt(dataset_path, delimiter=';')
stripped_name = dataset_path.split("\\")[1]
detector = stripped_name.split("_")[0]
descriptor =stripped_name.split("_")[1]
#do matchingu
#27 matching time # 28 calculation time # 2 nMatches
time_per_descriptor = []
time_per_match = []
time_per_descriptor = file_data[1:115,3]/file_data[1:115, 2] #TODO: zapytac Adama co znacza czasy
time_per_match = ( file_data[1:115,27]/(file_data[1:115,27]) ) / file_data[1:115,27]
return(detector, descriptor, time_per_descriptor, time_per_match)
for line in glob.glob("results_set001\*.txt"):
for word in line.split():
if line.endswith("_stat.txt")==False:
(det, desc, inl) = get_inlier_percentage(line)
if det == "brisk":
brisk_seq1.append(inl)
print(desc)
if det == "fast":
fast_seq1.append(inl)
if det == "gftt":
gftt_seq1.append(inl)
if det == "harris":
harris_seq1.append(inl)
if det == "orb":
orb_seq1.append(inl)
if det == "sift":
sift_seq1.append(inl)
if det == "star":
star_seq1.append(inl)
if det == "surf":
surf_seq1.append(inl)
for i in range(0, 6):
seq_temp = (brisk_seq1[0+i] + brisk_seq1[6+i] + brisk_seq1[12+i] + brisk_seq1[18+i] + brisk_seq1[24+i] + brisk_seq1[30+i])/6
brisk_seq_mean.append(seq_temp)
for i in range(0, 6):
seq_temp = (fast_seq1[0+i] + fast_seq1[6+i] + fast_seq1[12+i] + fast_seq1[18+i] + fast_seq1[24+i] + fast_seq1[30+i])/6
fast_seq_mean.append(seq_temp)
for i in range(0, 6):
seq_temp = (gftt_seq1[0+i] + gftt_seq1[6+i] + gftt_seq1[12+i] + gftt_seq1[18+i] + gftt_seq1[24+i] + gftt_seq1[30+i])/6
gftt_seq_mean.append(seq_temp)
for i in range(0, 6):
seq_temp = (harris_seq1[0+i] + harris_seq1[6+i] + harris_seq1[12+i] + harris_seq1[18+i] + harris_seq1[24+i] + harris_seq1[30+i])/6
harris_seq_mean.append(seq_temp)
for i in range(0, 6):
seq_temp = (orb_seq1[0+i] + orb_seq1[6+i] + orb_seq1[12+i] + orb_seq1[18+i] + orb_seq1[24+i] + orb_seq1[30+i])/6
orb_seq_mean.append(seq_temp)
##################### special treatment - no SIFT-ORB, inserting dummy data
#idx = ( 3, 9, 15, 21, 27, 33)
#np.insert(sift_seq1, idx, 0, axis=1)
sift_seq1.insert( 3, np.zeros(116))
sift_seq1.insert( 9, np.zeros(116))
sift_seq1.insert( 15, np.zeros(116))
sift_seq1.insert( 21, np.zeros(116))
sift_seq1.insert( 27, np.zeros(116))
sift_seq1.insert( 33, np.zeros(116))
#print(sift_seq1)
for i in range(0, 6):
seq_temp = (sift_seq1[0+i] + sift_seq1[6+i] + sift_seq1[12+i] + sift_seq1[18+i] + sift_seq1[24+i] + sift_seq1[30+i])/6
sift_seq_mean.append(seq_temp)
##################
for i in range(0, 6):
seq_temp = (star_seq1[0+i] + star_seq1[6+i] + star_seq1[12+i] + star_seq1[18+i] + star_seq1[24+i] + star_seq1[30+i])/6
star_seq_mean.append(seq_temp)
for i in range(0, 6):
seq_temp = (surf_seq1[0+i] + surf_seq1[6+i] + surf_seq1[12+i] + surf_seq1[18+i] + surf_seq1[24+i] + surf_seq1[30+i])/6
surf_seq_mean.append(seq_temp)
plt.subplot(2, 4, 1)
plt.ylim([0, 1])
plot_set(brisk_seq_mean)
plt.title("BRISK")
plt.subplot(2, 4, 2)
plt.ylim([0, 1])
plot_set(fast_seq_mean)
plt.title("FAST")
plt.subplot(2, 4, 3)
plt.ylim([0, 1])
plot_set(gftt_seq_mean)
plt.title("GFTT")
plt.subplot(2, 4, 4)
plt.ylim([0, 1])
plot_set(harris_seq_mean)
plt.title("HARRIS")
plt.subplot(2, 4, 5)
plt.ylim([0, 1])
plot_set(orb_seq1)
plt.title("ORB")
plt.subplot(2, 4, 6)
plt.ylim([0, 1])
plot_set(sift_seq_mean)
plt.title("SIFT")
plt.subplot(2, 4, 7)
plt.ylim([0, 1])
plot_set(star_seq_mean)
plt.title("STAR")
plt.subplot(2, 4, 8)
plt.ylim([0, 1])
plot_set(surf_seq_mean)
plt.title("SURF")
legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.)
show()