From 4a6579ea7efa0338c0a0f5e29d7c2c2fda8d0127 Mon Sep 17 00:00:00 2001 From: Josh Klontz Date: Tue, 9 Jun 2015 13:55:48 -0400 Subject: [PATCH] added SplitRowsTransform --- openbr/plugins/imgproc/split.cpp | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ openbr/plugins/imgproc/splitchannels.cpp | 48 ------------------------------------------------ 2 files changed, 67 insertions(+), 48 deletions(-) create mode 100644 openbr/plugins/imgproc/split.cpp delete mode 100644 openbr/plugins/imgproc/splitchannels.cpp diff --git a/openbr/plugins/imgproc/split.cpp b/openbr/plugins/imgproc/split.cpp new file mode 100644 index 0000000..83e5e63 --- /dev/null +++ b/openbr/plugins/imgproc/split.cpp @@ -0,0 +1,67 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 + +using namespace cv; + +namespace br +{ + +/*! + * \ingroup transforms + * \brief Split a multi-channel matrix into several single-channel matrices. + * \author Josh Klontz \cite jklontz + */ +class SplitChannelsTransform : public UntrainableTransform +{ + Q_OBJECT + + void project(const Template &src, Template &dst) const + { + std::vector mv; + split(src, mv); + foreach (const Mat &m, mv) + dst += m; + } +}; + +BR_REGISTER(Transform, SplitChannelsTransform) + +/*! + * \ingroup transforms + * \brief Split a multi-channel matrix into several single-channel matrices. + * \author Josh Klontz \cite jklontz + */ +class SplitRowsTransform : public UntrainableTransform +{ + Q_OBJECT + + void project(const Template &src, Template &dst) const + { + const Mat &m = src; + for (int i=0; i - -#include - -using namespace cv; - -namespace br -{ - -/*! - * \ingroup transforms - * \brief Split a multi-channel matrix into several single-channel matrices. - * \author Josh Klontz \cite jklontz - */ -class SplitChannelsTransform : public UntrainableTransform -{ - Q_OBJECT - - void project(const Template &src, Template &dst) const - { - std::vector mv; - split(src, mv); - foreach (const Mat &m, mv) - dst += m; - } -}; - -BR_REGISTER(Transform, SplitChannelsTransform) - -} // namespace br - -#include "imgproc/splitchannels.moc" -- libgit2 0.21.4