Commit dc0d217ec1a78c66efc2bf3d867a30a6d1066886

Authored by Josh Klontz
1 parent c522f25b

remove best

Showing 1 changed file with 0 additions and 74 deletions
openbr/plugins/output/best.cpp deleted
1 -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  
2 - * Copyright 2012 The MITRE Corporation *  
3 - * *  
4 - * Licensed under the Apache License, Version 2.0 (the "License"); *  
5 - * you may not use this file except in compliance with the License. *  
6 - * You may obtain a copy of the License at *  
7 - * *  
8 - * http://www.apache.org/licenses/LICENSE-2.0 *  
9 - * *  
10 - * Unless required by applicable law or agreed to in writing, software *  
11 - * distributed under the License is distributed on an "AS IS" BASIS, *  
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *  
13 - * See the License for the specific language governing permissions and *  
14 - * limitations under the License. *  
15 - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */  
16 -  
17 -#include <openbr/plugins/openbr_internal.h>  
18 -#include <openbr/core/qtutils.h>  
19 -  
20 -namespace br  
21 -{  
22 -  
23 -/*!  
24 - * \ingroup outputs  
25 - * \brief The highest scoring matches.  
26 - * \author Josh Klontz \cite jklontz  
27 - */  
28 -class bestOutput : public Output  
29 -{  
30 - Q_OBJECT  
31 -  
32 - typedef QPair< float, QPair<int, int> > BestMatch;  
33 - QList<BestMatch> bestMatches;  
34 -  
35 - ~bestOutput()  
36 - {  
37 - if (file.isNull() || bestMatches.isEmpty()) return;  
38 - qSort(bestMatches);  
39 - QStringList lines; lines.reserve(bestMatches.size()+1);  
40 - lines.append("Value,Target,Query");  
41 - for (int i=bestMatches.size()-1; i>=0; i--)  
42 - lines.append(QString::number(bestMatches[i].first) + "," + targetFiles[bestMatches[i].second.second] + "," + queryFiles[bestMatches[i].second.first]);  
43 - QtUtils::writeFile(file, lines);  
44 - }  
45 -  
46 - void initialize(const FileList &targetFiles, const FileList &queryFiles)  
47 - {  
48 - Output::initialize(targetFiles, queryFiles);  
49 - bestMatches.reserve(queryFiles.size());  
50 - for (int i=0; i<queryFiles.size(); i++)  
51 - bestMatches.append(BestMatch(-std::numeric_limits<float>::max(), QPair<int,int>(-1, -1)));  
52 - }  
53 -  
54 - void set(float value, int i, int j)  
55 - {  
56 - static QMutex lock;  
57 -  
58 - // Return early for self similar matrices  
59 - if (selfSimilar && (i == j)) return;  
60 -  
61 - if (value > bestMatches[i].first) {  
62 - lock.lock();  
63 - if (value > bestMatches[i].first)  
64 - bestMatches[i] = BestMatch(value, QPair<int,int>(i,j));  
65 - lock.unlock();  
66 - }  
67 - }  
68 -};  
69 -  
70 -BR_REGISTER(Output, bestOutput)  
71 -  
72 -} // namespace br  
73 -  
74 -#include "output/best.moc"