Commit 00d52cfb259348934c2de970d0f0818548b690c7

Authored by Josh Klontz
1 parent 097cfe20

remove origlinearregression

openbr/plugins/imgproc/origlinearregression.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   -using namespace cv;
20   -
21   -namespace br
22   -{
23   -
24   -/*!
25   - * \ingroup transforms
26   - * \brief Prediction with magic numbers from jmp; must get input as blue;green;red
27   - * \author E. Taborsky \cite mmtaborsky
28   - */
29   -class OrigLinearRegressionTransform : public UntrainableMetaTransform
30   -{
31   - Q_OBJECT
32   -
33   - void project(const Template &src, Template &dst) const
34   - {
35   - if (src.size() != 3) qFatal("Expected exactly three source images, got %d.", src.size());
36   - Mat m1; src[0].convertTo(m1, CV_32F); assert(m1.isContinuous() && (m1.channels() == 1));
37   - Mat m2; src[1].convertTo(m2, CV_32F); assert(m2.isContinuous() && (m2.channels() == 1));
38   - Mat m3; src[2].convertTo(m3, CV_32F); assert(m3.isContinuous() && (m3.channels() == 1));
39   -
40   - const float rmult = .809911, gmult = -.09625, bmult = -.020115, add = 35.78;
41   -
42   - Mat dstmat(m1.size(), CV_32F);
43   -
44   - int rows = m1.rows;
45   - int cols = m1.cols;
46   -
47   - const float *pb = (const float*) m1.ptr(), *pg = (const float*) m2.ptr(), *pr = (const float*) m3.ptr();
48   - float *pd = (float*)dstmat.ptr();
49   - for (int r = 0; r < rows; r++){
50   - for (int c = 0; c < cols; c++){
51   - int index = r*cols+c;
52   - const float bval = pb[index], gval = pg[index], rval = pr[index];
53   - pd[index] = bval*bmult+ gval*gmult+rval*rmult+add;
54   - }
55   - }
56   - dst = dstmat;
57   - }
58   -};
59   -
60   -BR_REGISTER(Transform, OrigLinearRegressionTransform)
61   -
62   -} // namespace br
63   -
64   -#include "imgproc/origlinearregression.moc"