Commit 54a81a89b7a3a8e09e165d4d2573430b35bb0a25
1 parent
169c866a
removed online distance
Showing
1 changed file
with
0 additions
and
51 deletions
openbr/plugins/distance/online.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 | - | ||
| 19 | -namespace br | ||
| 20 | -{ | ||
| 21 | - | ||
| 22 | -/*! | ||
| 23 | - * \ingroup distances | ||
| 24 | - * \brief Online Distance metric to attenuate match scores across multiple frames | ||
| 25 | - * \author Brendan klare \cite bklare | ||
| 26 | - */ | ||
| 27 | -class OnlineDistance : public UntrainableDistance | ||
| 28 | -{ | ||
| 29 | - Q_OBJECT | ||
| 30 | - Q_PROPERTY(br::Distance* distance READ get_distance WRITE set_distance RESET reset_distance STORED false) | ||
| 31 | - Q_PROPERTY(float alpha READ get_alpha WRITE set_alpha RESET reset_alpha STORED false) | ||
| 32 | - BR_PROPERTY(br::Distance*, distance, NULL) | ||
| 33 | - BR_PROPERTY(float, alpha, 0.1f) | ||
| 34 | - | ||
| 35 | - mutable QHash<QString,float> scoreHash; | ||
| 36 | - mutable QMutex mutex; | ||
| 37 | - | ||
| 38 | - float compare(const Template &target, const Template &query) const | ||
| 39 | - { | ||
| 40 | - float currentScore = distance->compare(target, query); | ||
| 41 | - | ||
| 42 | - QMutexLocker mutexLocker(&mutex); | ||
| 43 | - return scoreHash[target.file.name] = (1.0- alpha) * scoreHash[target.file.name] + alpha * currentScore; | ||
| 44 | - } | ||
| 45 | -}; | ||
| 46 | - | ||
| 47 | -BR_REGISTER(Distance, OnlineDistance) | ||
| 48 | - | ||
| 49 | -} // namespace br | ||
| 50 | - | ||
| 51 | -#include "distance/online.moc" |