Commit 3848bb3cfb81cea9bd4c12e2fc27b95ed504b7bb
1 parent
62aba168
remove rowwisemeancenter
Showing
1 changed file
with
0 additions
and
66 deletions
openbr/plugins/imgproc/rowwisemeancenter.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/opencvutils.h> | |
| 19 | - | |
| 20 | -using namespace cv; | |
| 21 | - | |
| 22 | -namespace br | |
| 23 | -{ | |
| 24 | - | |
| 25 | -/*! | |
| 26 | - * \ingroup transforms | |
| 27 | - * \brief Remove the row-wise training set average. | |
| 28 | - * \author Josh Klontz \cite jklontz | |
| 29 | - */ | |
| 30 | -class RowWiseMeanCenterTransform : public Transform | |
| 31 | -{ | |
| 32 | - Q_OBJECT | |
| 33 | - Mat mean; | |
| 34 | - | |
| 35 | - void train(const TemplateList &data) | |
| 36 | - { | |
| 37 | - Mat m = OpenCVUtils::toMatByRow(data.data()); | |
| 38 | - mean = Mat(1, m.cols, m.type()); | |
| 39 | - for (int i=0; i<m.cols; i++) | |
| 40 | - mean.col(i) = cv::mean(m.col(i)); | |
| 41 | - } | |
| 42 | - | |
| 43 | - void project(const Template &src, Template &dst) const | |
| 44 | - { | |
| 45 | - Mat m = src.m().clone(); | |
| 46 | - for (int i=0; i<m.rows; i++) | |
| 47 | - m.row(i) -= mean; | |
| 48 | - dst = m; | |
| 49 | - } | |
| 50 | - | |
| 51 | - void store(QDataStream &stream) const | |
| 52 | - { | |
| 53 | - stream << mean; | |
| 54 | - } | |
| 55 | - | |
| 56 | - void load(QDataStream &stream) | |
| 57 | - { | |
| 58 | - stream >> mean; | |
| 59 | - } | |
| 60 | -}; | |
| 61 | - | |
| 62 | -BR_REGISTER(Transform, RowWiseMeanCenterTransform) | |
| 63 | - | |
| 64 | -} // namespace br | |
| 65 | - | |
| 66 | -#include "imgproc/rowwisemeancenter.moc" |