Commit 602042ab6b98a88d8a20ab5a4417fae6a41c4e5a

Authored by Josh Klontz
1 parent c8a00310

removed collectnn

openbr/plugins/cluster/collectnn.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 transforms
24   - * \brief Collect nearest neighbors and append them to metadata.
25   - * \author Charles Otto \cite caotto
26   - * \br_property int keep The maximum number of nearest neighbors to keep. Default is 20.
27   - */
28   -class CollectNNTransform : public UntrainableMetaTransform
29   -{
30   - Q_OBJECT
31   -
32   - Q_PROPERTY(int keep READ get_keep WRITE set_keep RESET reset_keep STORED false)
33   - BR_PROPERTY(int, keep, 20)
34   -
35   - void project(const Template &src, Template &dst) const
36   - {
37   - dst.file = src.file;
38   - dst.clear();
39   - dst.m() = cv::Mat();
40   - Neighbors neighbors;
41   - for (int i=0; i < src.m().cols;i++) {
42   - // skip self compares
43   - if (i == src.file.get<int>("FrameNumber"))
44   - continue;
45   - neighbors.append(Neighbor(i, src.m().at<float>(0,i)));
46   - }
47   - int actuallyKeep = std::min(keep, neighbors.size());
48   - std::partial_sort(neighbors.begin(), neighbors.begin()+actuallyKeep, neighbors.end(), compareNeighbors);
49   -
50   - Neighbors selected = neighbors.mid(0, actuallyKeep);
51   - dst.file.set("neighbors", QVariant::fromValue(selected));
52   - }
53   -};
54   -
55   -BR_REGISTER(Transform, CollectNNTransform)
56   -
57   -} // namespace br
58   -
59   -#include "cluster/collectnn.moc"