Commit a9423b0172bfa2708b5f9ae80b1ea1d5f1bf2030
1 parent
8a444f8c
remove rr
Showing
1 changed file
with
0 additions
and
71 deletions
openbr/plugins/output/rr.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/common.h> | |
| 19 | -#include <openbr/core/qtutils.h> | |
| 20 | -#include <openbr/core/opencvutils.h> | |
| 21 | - | |
| 22 | -namespace br | |
| 23 | -{ | |
| 24 | - | |
| 25 | -/*! | |
| 26 | - * \ingroup outputs | |
| 27 | - * \brief Rank retrieval output. | |
| 28 | - * \author Josh Klontz \cite jklontz | |
| 29 | - * \author Scott Klum \cite sklum | |
| 30 | - */ | |
| 31 | -class rrOutput : public MatrixOutput | |
| 32 | -{ | |
| 33 | - Q_OBJECT | |
| 34 | - | |
| 35 | - ~rrOutput() | |
| 36 | - { | |
| 37 | - if (file.isNull() || targetFiles.isEmpty() || queryFiles.isEmpty()) return; | |
| 38 | - const int limit = file.get<int>("limit", 20); | |
| 39 | - const bool byLine = file.getBool("byLine"); | |
| 40 | - const bool simple = file.getBool("simple"); | |
| 41 | - const float threshold = file.get<float>("threshold", -std::numeric_limits<float>::max()); | |
| 42 | - | |
| 43 | - QStringList lines; | |
| 44 | - | |
| 45 | - for (int i=0; i<queryFiles.size(); i++) { | |
| 46 | - QStringList files; | |
| 47 | - if (simple) files.append(queryFiles[i].fileName()); | |
| 48 | - | |
| 49 | - typedef QPair<float,int> Pair; | |
| 50 | - foreach (const Pair &pair, Common::Sort(OpenCVUtils::matrixToVector<float>(data.row(i)), true, limit)) { | |
| 51 | - // Check if target files are marked as allParitions, and make sure target and query files are in the same partition | |
| 52 | - if (Globals->crossValidate > 0 ? (targetFiles[pair.second].get<int>("Partition",-1) == -1 || targetFiles[pair.second].get<int>("Partition",-1) == queryFiles[i].get<int>("Partition",-1)) : true) { | |
| 53 | - if (pair.first < threshold) break; | |
| 54 | - File target = targetFiles[pair.second]; | |
| 55 | - target.set("Score", QString::number(pair.first)); | |
| 56 | - if (simple) files.append(target.fileName() + " " + QString::number(pair.first)); | |
| 57 | - else files.append(target.flat()); | |
| 58 | - } | |
| 59 | - } | |
| 60 | - lines.append(files.join(byLine ? "\n" : ",")); | |
| 61 | - } | |
| 62 | - | |
| 63 | - QtUtils::writeFile(file, lines); | |
| 64 | - } | |
| 65 | -}; | |
| 66 | - | |
| 67 | -BR_REGISTER(Output, rrOutput) | |
| 68 | - | |
| 69 | -} // namespace br | |
| 70 | - | |
| 71 | -#include "output/rr.moc" |