Commit 46e22263a86ddd6adc3f4623e4bb3cb01341739e

Authored by Josh Klontz
1 parent 00d52cfb

remove rank

Showing 1 changed file with 0 additions and 60 deletions
openbr/plugins/imgproc/rank.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   -#include <openbr/core/common.h>
19   -#include <openbr/core/opencvutils.h>
20   -
21   -using namespace cv;
22   -
23   -namespace br
24   -{
25   -
26   -/*!
27   - * \ingroup transforms
28   - * \brief Converts each element to its rank-ordered value.
29   - * \author Josh Klontz \cite jklontz
30   - */
31   -class RankTransform : public UntrainableTransform
32   -{
33   - Q_OBJECT
34   -
35   - void project(const Template &src, Template &dst) const
36   - {
37   - const Mat &m = src;
38   - assert(m.channels() == 1);
39   - dst = Mat(m.rows, m.cols, CV_32FC1);
40   - typedef QPair<float,int> Tuple;
41   - QList<Tuple> tuples = Common::Sort(OpenCVUtils::matrixToVector<float>(m));
42   -
43   - float prevValue = 0;
44   - int prevRank = 0;
45   - for (int i=0; i<tuples.size(); i++) {
46   - int rank;
47   - if (tuples[i].first == prevValue) rank = prevRank;
48   - else rank = i;
49   - dst.m().at<float>(tuples[i].second / m.cols, tuples[i].second % m.cols) = rank;
50   - prevValue = tuples[i].first;
51   - prevRank = rank;
52   - }
53   - }
54   -};
55   -
56   -BR_REGISTER(Transform, RankTransform)
57   -
58   -} // namespace br
59   -
60   -#include "imgproc/rank.moc"