From ac8caa742fe974139ca4a9bf53a85b8cdb407924 Mon Sep 17 00:00:00 2001 From: Josh Klontz Date: Tue, 31 Aug 2021 17:36:03 -0600 Subject: [PATCH] remove rndsubspace --- openbr/plugins/imgproc/rg.cpp | 67 ------------------------------------------------------------------- openbr/plugins/imgproc/rndsubspace.cpp | 108 ------------------------------------------------------------------------------------------------------------ 2 files changed, 0 insertions(+), 175 deletions(-) delete mode 100644 openbr/plugins/imgproc/rg.cpp delete mode 100644 openbr/plugins/imgproc/rndsubspace.cpp diff --git a/openbr/plugins/imgproc/rg.cpp b/openbr/plugins/imgproc/rg.cpp deleted file mode 100644 index 401d8f0..0000000 --- a/openbr/plugins/imgproc/rg.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright 2012 The MITRE Corporation * - * * - * Licensed under the Apache License, Version 2.0 (the "License"); * - * you may not use this file except in compliance with the License. * - * You may obtain a copy of the License at * - * * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an "AS IS" BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include - -using namespace cv; - -namespace br -{ - -/*! - * \ingroup transforms - * \brief Normalized RG color space. - * \author Josh Klontz \cite jklontz - */ -class RGTransform : public UntrainableTransform -{ - Q_OBJECT - - void project(const Template &src, Template &dst) const - { - if (src.m().type() != CV_8UC3) - qFatal("Expected CV_8UC3 images."); - - const Mat &m = src.m(); - Mat R(m.size(), CV_8UC1); // R / (R+G+B) - Mat G(m.size(), CV_8UC1); // G / (R+G+B) - - for (int i=0; i(i,j); - const int b = v[0]; - const int g = v[1]; - const int r = v[2]; - const int sum = b + g + r; - if (sum > 0) { - R.at(i, j) = saturate_cast(255.0*r/(r+g+b)); - G.at(i, j) = saturate_cast(255.0*g/(r+g+b)); - } else { - R.at(i, j) = 0; - G.at(i, j) = 0; - } - } - - dst.append(R); - dst.append(G); - } -}; - -BR_REGISTER(Transform, RGTransform) - -} // namespace br - -#include "imgproc/rg.moc" diff --git a/openbr/plugins/imgproc/rndsubspace.cpp b/openbr/plugins/imgproc/rndsubspace.cpp deleted file mode 100644 index 423dbc9..0000000 --- a/openbr/plugins/imgproc/rndsubspace.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright 2012 The MITRE Corporation * - * * - * Licensed under the Apache License, Version 2.0 (the "License"); * - * you may not use this file except in compliance with the License. * - * You may obtain a copy of the License at * - * * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, software * - * distributed under the License is distributed on an "AS IS" BASIS, * - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * - * See the License for the specific language governing permissions and * - * limitations under the License. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include - -#include -#include -#include - -using namespace cv; - -namespace br -{ - -/*! - * \ingroup transforms - * \brief Generates a random subspace. - * \author Josh Klontz \cite jklontz - */ -class RndSubspaceTransform : public MetaTransform -{ - Q_OBJECT - Q_PROPERTY(float fraction READ get_fraction WRITE set_fraction RESET reset_fraction STORED false) - Q_PROPERTY(bool weighted READ get_weighted WRITE set_weighted RESET reset_weighted STORED false) - BR_PROPERTY(float, fraction, 0.5) - BR_PROPERTY(bool, weighted, false) - - QList maps; - - void train(const TemplateList &data) - { - // While RndSubspace transform could be independent, making it a MetaTransform is a workaround - // for parallel random number generation being difficult on Windows due to thread-local - // RNG states all initialized with the same seed and thus producing the same sequence of random numbers. - for (int index=0; index weights; weights.reserve(size); - if (weighted) { - Mat flatData = OpenCVUtils::toMat(data.data()); - for (int i=0; i sample = Common::RandSample(dimsOut, weights); - Mat xMap(1, dimsOut, CV_16SC1); - Mat yMap(1, dimsOut, CV_16SC1); - for (int j=0; j(0,j) = index % cols; - yMap.at(0,j) = index / cols; - } - std::vector mv; - mv.push_back(xMap); - mv.push_back(yMap); - - Mat map; - merge(mv, map); - maps.append(map); - } - } - - void project(const Template &src, Template &dst) const - { - dst.file = src.file; - for (int i=0; i> maps; - } -}; - -BR_REGISTER(Transform, RndSubspaceTransform) - -} // namespace br - -#include "imgproc/rndsubspace.moc" -- libgit2 0.21.4