Commit 313b8237b08af8395a788f421f9998cd6c2b70ef
1 parent
6ebaafcb
removed sum distance
Showing
1 changed file
with
0 additions
and
60 deletions
openbr/plugins/distance/sum.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 <QtConcurrent> | ||
| 18 | - | ||
| 19 | -#include <openbr/plugins/openbr_internal.h> | ||
| 20 | - | ||
| 21 | -namespace br | ||
| 22 | -{ | ||
| 23 | - | ||
| 24 | -/*! | ||
| 25 | - * \ingroup distances | ||
| 26 | - * \brief Sum match scores across multiple Distances | ||
| 27 | - * \author Scott Klum \cite sklum | ||
| 28 | - */ | ||
| 29 | -class SumDistance : public ListDistance | ||
| 30 | -{ | ||
| 31 | - Q_OBJECT | ||
| 32 | - | ||
| 33 | - void train(const TemplateList &data) | ||
| 34 | - { | ||
| 35 | - QFutureSynchronizer<void> futures; | ||
| 36 | - foreach (br::Distance *distance, distances) | ||
| 37 | - futures.addFuture(QtConcurrent::run(distance, &Distance::train, data)); | ||
| 38 | - futures.waitForFinished(); | ||
| 39 | - } | ||
| 40 | - | ||
| 41 | - float compare(const Template &target, const Template &query) const | ||
| 42 | - { | ||
| 43 | - float result = 0; | ||
| 44 | - | ||
| 45 | - foreach (br::Distance *distance, distances) { | ||
| 46 | - result += distance->compare(target, query); | ||
| 47 | - | ||
| 48 | - if (result == -std::numeric_limits<float>::max()) | ||
| 49 | - return result; | ||
| 50 | - } | ||
| 51 | - | ||
| 52 | - return result; | ||
| 53 | - } | ||
| 54 | -}; | ||
| 55 | - | ||
| 56 | -BR_REGISTER(Distance, SumDistance) | ||
| 57 | - | ||
| 58 | -} // namespace br | ||
| 59 | - | ||
| 60 | -#include "distance/sum.moc" |