Commit 7f975bbf06f1581665061f0391be3e0c438cb43e
1 parent
4e6ebc9f
removed turk distance
Showing
1 changed file
with
0 additions
and
65 deletions
openbr/plugins/distance/turk.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/opencvutils.h> | |
| 19 | - | |
| 20 | -namespace br | |
| 21 | -{ | |
| 22 | - | |
| 23 | -/*! | |
| 24 | - * \ingroup distances | |
| 25 | - * \brief Unmaps Turk HITs to be compared against query mats | |
| 26 | - * \author Scott Klum \cite sklum | |
| 27 | - */ | |
| 28 | -class TurkDistance : public UntrainableDistance | |
| 29 | -{ | |
| 30 | - Q_OBJECT | |
| 31 | - Q_PROPERTY(QString key READ get_key WRITE set_key RESET reset_key) | |
| 32 | - Q_PROPERTY(QStringList values READ get_values WRITE set_values RESET reset_values STORED false) | |
| 33 | - BR_PROPERTY(QString, key, QString()) | |
| 34 | - BR_PROPERTY(QStringList, values, QStringList()) | |
| 35 | - | |
| 36 | - bool targetHuman; | |
| 37 | - bool queryMachine; | |
| 38 | - | |
| 39 | - void init() | |
| 40 | - { | |
| 41 | - targetHuman = Globals->property("TurkTargetHuman").toBool(); | |
| 42 | - queryMachine = Globals->property("TurkQueryMachine").toBool(); | |
| 43 | - } | |
| 44 | - | |
| 45 | - cv::Mat getValues(const Template &t) const | |
| 46 | - { | |
| 47 | - QList<float> result; | |
| 48 | - foreach (const QString &value, values) | |
| 49 | - result.append(t.file.get<float>(key + "_" + value)); | |
| 50 | - return OpenCVUtils::toMat(result, 1); | |
| 51 | - } | |
| 52 | - | |
| 53 | - float compare(const Template &target, const Template &query) const | |
| 54 | - { | |
| 55 | - const cv::Mat a = targetHuman ? getValues(target) : target.m(); | |
| 56 | - const cv::Mat b = queryMachine ? query.m() : getValues(query); | |
| 57 | - return -norm(a, b, cv::NORM_L1); | |
| 58 | - } | |
| 59 | -}; | |
| 60 | - | |
| 61 | -BR_REGISTER(Distance, TurkDistance) | |
| 62 | - | |
| 63 | -} // namespace br | |
| 64 | - | |
| 65 | -#include "distance/turk.moc" |