Commit e158113455138b07186295ba563e356c5b4b9cf7
1 parent
562fac56
removed attribute distance
Showing
1 changed file
with
0 additions
and
50 deletions
openbr/plugins/distance/attribute.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 Attenuation function based distance from attributes | |
| 25 | - * \author Scott Klum \cite sklum | |
| 26 | - */ | |
| 27 | -class AttributeDistance : public UntrainableDistance | |
| 28 | -{ | |
| 29 | - Q_OBJECT | |
| 30 | - Q_PROPERTY(QString attribute READ get_attribute WRITE set_attribute RESET reset_attribute STORED false) | |
| 31 | - BR_PROPERTY(QString, attribute, QString()) | |
| 32 | - | |
| 33 | - float compare(const Template &target, const Template &query) const | |
| 34 | - { | |
| 35 | - float queryValue = query.file.get<float>(attribute); | |
| 36 | - float targetValue = target.file.get<float>(attribute); | |
| 37 | - | |
| 38 | - // TODO: Set this magic number to something meaningful | |
| 39 | - float stddev = 1; | |
| 40 | - | |
| 41 | - if (queryValue == targetValue) return 1; | |
| 42 | - else return 1/(stddev*sqrt(2*CV_PI))*exp(-0.5*pow((targetValue-queryValue)/stddev, 2)); | |
| 43 | - } | |
| 44 | -}; | |
| 45 | - | |
| 46 | -BR_REGISTER(Distance, AttributeDistance) | |
| 47 | - | |
| 48 | -} // namespace br | |
| 49 | - | |
| 50 | -#include "distance/attribute.moc" |