Skip to content

Commit b844d73

Browse files
author
Carsten Griwodz
committed
[test] new option dv, fix codacy bug
1 parent 3e0c847 commit b844d73

2 files changed

Lines changed: 31 additions & 17 deletions

File tree

testScripts/CompareDescriptors/compareSiftFiles.cpp

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ void usage( char* name );
1717

1818
const char* outfile_name = 0;
1919
const char* descfile_name = 0;
20+
bool descfile_verbose = false;
2021

2122
int main( int argc, char* argv[] )
2223
{
@@ -51,6 +52,13 @@ int main( int argc, char* argv[] )
5152
argc -= 2;
5253
argv += 2;
5354
}
55+
else if( !strcmp( argv[1], "-dv" ) )
56+
{
57+
descfile_name = argv[2];
58+
argc -= 2;
59+
argv += 2;
60+
descfile_verbose = true;
61+
}
5462
else
5563
{
5664
break;
@@ -111,7 +119,9 @@ int main( int argc, char* argv[] )
111119

112120
for( auto l : l_one )
113121
{
114-
l.compareBestMatch( *outfile, descfile, l_two, desc_stats, briefinfo );
122+
ostream* print_dists = descfile_verbose ? descfile : 0;
123+
124+
l.compareBestMatch( *outfile, print_dists, l_two, desc_stats, briefinfo );
115125
ct++;
116126
if( float(ct * 100) / len >= float(nextpercent) )
117127
{
@@ -120,21 +130,24 @@ int main( int argc, char* argv[] )
120130
}
121131
}
122132

123-
int sz = l_one.size();
124-
(*descfile) << "========== Summary Stats ==========" << endl
125-
<< "Average values:" << endl
126-
<< setprecision(3);
127-
for( int i=0; i<128; i++ )
133+
if( descfile )
128134
{
129-
if( i%32==0 ) (*descfile) << "X=0 | ";
130-
if( i%32==8 ) (*descfile) << "X=1 | ";
131-
if( i%32==16 ) (*descfile) << "X=2 | ";
132-
if( i%32==24 ) (*descfile) << "X=3 | ";
133-
desc_stats[i] /= sz;
134-
(*descfile) << setw(8) << desc_stats[i] << " ";
135-
if( i%8==7 ) (*descfile) << endl;
135+
int sz = l_one.size();
136+
(*descfile) << "========== Summary Stats ==========" << endl
137+
<< "Average values:" << endl
138+
<< setprecision(3);
139+
for( int i=0; i<128; i++ )
140+
{
141+
if( i%32==0 ) (*descfile) << "X=0 | ";
142+
if( i%32==8 ) (*descfile) << "X=1 | ";
143+
if( i%32==16 ) (*descfile) << "X=2 | ";
144+
if( i%32==24 ) (*descfile) << "X=3 | ";
145+
desc_stats[i] /= sz;
146+
(*descfile) << setw(8) << desc_stats[i] << " ";
147+
if( i%8==7 ) (*descfile) << endl;
148+
}
149+
(*descfile) << endl;
136150
}
137-
(*descfile) << endl;
138151

139152
if( outfile_name != 0 )
140153
{
@@ -153,7 +166,8 @@ void usage( char* name )
153166
<< " -v : verbose, longer output" << endl
154167
<< " -l1 : use L1 for distance computation instead of L2" << endl
155168
<< " -o <file> : print essential diff info to <file> (default is cout)" << endl
156-
<< " -d <file> : print descriptor distance per cell to <file>" << endl
169+
<< " -d[v] <file> : print descriptor distance per cell to <file>" << endl
170+
<< " d prints a summary, v prints every comparison" << endl
157171
<< endl;
158172
exit( 0 );
159173
}

testScripts/CompareDescriptors/csf_feat.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,10 @@ void feat_t::compareBestMatch( ostream& ostr, ostream* dstr, const vector<feat_t
127127
for( int i=0; i<128; i++, left++, right++ )
128128
{
129129
float diff = *left - *right;
130-
// (*dstr) << diff << " ";
130+
(*dstr) << diff << " ";
131131
desc_stats[i] += diff;
132132
}
133-
// (*dstr) << endl;
133+
(*dstr) << endl;
134134
}
135135
}
136136
else if( *it > *m )

0 commit comments

Comments
 (0)