diff --git a/openbr/plugins/imgproc/gradient.cpp b/openbr/plugins/imgproc/gradient.cpp deleted file mode 100644 index 1f38f89..0000000 --- a/openbr/plugins/imgproc/gradient.cpp +++ /dev/null @@ -1,66 +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 - -using namespace cv; - -namespace br -{ - -/*! - * \ingroup transforms - * \brief Computes magnitude and/or angle of image. - * \author Josh Klontz \cite jklontz - */ -class GradientTransform : public UntrainableTransform -{ - Q_OBJECT - Q_ENUMS(Channel) - Q_PROPERTY(Channel channel READ get_channel WRITE set_channel RESET reset_channel STORED false) - -public: - enum Channel { Magnitude, Angle, MagnitudeAndAngle }; - -private: - BR_PROPERTY(Channel, channel, Angle) - - void project(const Template &src, Template &dst) const - { - Mat dx, dy, magnitude, angle; - Sobel(src, dx, CV_32F, 1, 0, FILTER_SCHARR); - Sobel(src, dy, CV_32F, 0, 1, FILTER_SCHARR); - cartToPolar(dx, dy, magnitude, angle, true); - std::vector mv; - if ((channel == Magnitude) || (channel == MagnitudeAndAngle)) { - const float theoreticalMaxMagnitude = sqrt(2*pow(float(2*(3+10+3)*255), 2.f)); - mv.push_back(magnitude / theoreticalMaxMagnitude); - } - if ((channel == Angle) || (channel == MagnitudeAndAngle)) - mv.push_back(angle); - Mat result; - merge(mv, result); - dst.append(result); - } -}; - -BR_REGISTER(Transform, GradientTransform) - -} // namespace br - -#include "imgproc/gradient.moc" diff --git a/openbr/plugins/imgproc/gradientmask.cpp b/openbr/plugins/imgproc/gradientmask.cpp deleted file mode 100644 index 5f7064f..0000000 --- a/openbr/plugins/imgproc/gradientmask.cpp +++ /dev/null @@ -1,57 +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 Masks image according to pixel change. - * \author Josh Klontz \cite jklontz - */ -class GradientMaskTransform : public UntrainableTransform -{ - Q_OBJECT - Q_PROPERTY(int delta READ get_delta WRITE set_delta RESET reset_delta STORED false) - BR_PROPERTY(int, delta, 1) - - void project(const Template &src, Template &dst) const - { - const Mat &m = src.m(); - if (m.type() != CV_8UC1) qFatal("Requires 8UC1 matrices."); - Mat n = Mat(m.rows, m.cols, CV_8UC1); - n.setTo(255); - for (int i=0; i0) && (abs(m.at(i-1,j)-m.at(i,j)) > delta)) { n.at(i,j) = 0; continue; } - if ((j+1(i,j+1)-m.at(i,j)) > delta)) { n.at(i,j) = 0; continue; } - if ((i+1(i+1,j)-m.at(i,j)) > delta)) { n.at(i,j) = 0; continue; } - if ((j>0) && (abs(m.at(i,j-1)-m.at(i,j)) > delta)) { n.at(i,j) = 0; continue; } - } - } - dst = n; - } -}; - -BR_REGISTER(Transform, GradientMaskTransform) - -} // namespace br - -#include "imgproc/gradientmask.moc"