Commit 8454014c1161f9d2d8f57e437634fe408469f1c8

Authored by Josh Klontz
1 parent 543fb2f4

removed pipe distance

openbr/plugins/distance/pipe.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 Distances in series.
27   - *
28   - * The Templates are compared using each Distance in order.
29   - * If the result of the comparison with any given distance is -FLOAT_MAX then this result is returned early.
30   - * Otherwise the returned result is the value of comparing the Templates using the last Distance.
31   - *
32   - * \author Josh Klontz \cite jklontz
33   - *
34   - */
35   -class PipeDistance : public ListDistance
36   -{
37   - Q_OBJECT
38   -
39   - void train(const TemplateList &data)
40   - {
41   - QFutureSynchronizer<void> futures;
42   - foreach (br::Distance *distance, distances)
43   - futures.addFuture(QtConcurrent::run(distance, &Distance::train, data));
44   - futures.waitForFinished();
45   - }
46   -
47   - float compare(const Template &a, const Template &b) const
48   - {
49   - float result = -std::numeric_limits<float>::max();
50   - foreach (br::Distance *distance, distances) {
51   - result = distance->compare(a, b);
52   - if (result == -std::numeric_limits<float>::max())
53   - return result;
54   - }
55   - return result;
56   - }
57   -};
58   -
59   -BR_REGISTER(Distance, PipeDistance)
60   -
61   -} // namespace br
62   -
63   -#include "distance/pipe.moc"