Commit 4e6ebc9ff394c717186072a04f74c9d1a7ba4a56
1 parent
313b8237
removed threshold distance
Showing
1 changed file
with
0 additions
and
62 deletions
openbr/plugins/distance/threshold.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 Applys a hard threshold to similarity values. | ||
| 25 | - * \author Scott Klum \cite sklum | ||
| 26 | - */ | ||
| 27 | -class ThresholdDistance : public Distance | ||
| 28 | -{ | ||
| 29 | - Q_OBJECT | ||
| 30 | - | ||
| 31 | - Q_PROPERTY(br::Distance* distance READ get_distance WRITE set_distance RESET reset_distance) | ||
| 32 | - Q_PROPERTY(float min READ get_min WRITE set_min RESET reset_min) | ||
| 33 | - Q_PROPERTY(float max READ get_max WRITE set_max RESET reset_max) | ||
| 34 | - BR_PROPERTY(br::Distance*, distance, NULL) | ||
| 35 | - BR_PROPERTY(float, min, -std::numeric_limits<float>::max()) | ||
| 36 | - BR_PROPERTY(float, max, std::numeric_limits<float>::max()) | ||
| 37 | - | ||
| 38 | - bool trainable() | ||
| 39 | - { | ||
| 40 | - return distance->trainable(); | ||
| 41 | - } | ||
| 42 | - | ||
| 43 | - void train(const TemplateList &src) | ||
| 44 | - { | ||
| 45 | - distance->train(src); | ||
| 46 | - } | ||
| 47 | - | ||
| 48 | - float compare(const Template &a, const Template &b) const | ||
| 49 | - { | ||
| 50 | - float value = distance->compare(a,b); | ||
| 51 | - if (value < min) value = min; | ||
| 52 | - else if (value > max) value = max; | ||
| 53 | - return value; | ||
| 54 | - } | ||
| 55 | -}; | ||
| 56 | - | ||
| 57 | -BR_REGISTER(Distance, ThresholdDistance) | ||
| 58 | - | ||
| 59 | -} // namespace br | ||
| 60 | - | ||
| 61 | -#include "distance/threshold.moc" | ||
| 62 | - |