From 4e1574bb7f3c97afd1bd23afb84e1f4038bcd35b Mon Sep 17 00:00:00 2001 From: Jordan Cheney Date: Thu, 19 Feb 2015 16:19:45 -0500 Subject: [PATCH] Fixing mistakes --- openbr/plugins/cmake/stasm4.cmake | 2 +- openbr/plugins/imgproc/cvt.cpp | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ openbr/plugins/imgproc/cvtcolor.cpp | 71 ----------------------------------------------------------------------- 3 files changed, 72 insertions(+), 72 deletions(-) create mode 100644 openbr/plugins/imgproc/cvt.cpp delete mode 100644 openbr/plugins/imgproc/cvtcolor.cpp diff --git a/openbr/plugins/cmake/stasm4.cmake b/openbr/plugins/cmake/stasm4.cmake index fa52d2b..7bebf3e 100644 --- a/openbr/plugins/cmake/stasm4.cmake +++ b/openbr/plugins/cmake/stasm4.cmake @@ -1,4 +1,4 @@ -set(BR_WITH_STASM4 OFF CACHE BOOL "Build with Stasm") +set(BR_WITH_STASM4 ON CACHE BOOL "Build with Stasm") if(${BR_WITH_STASM4}) find_package(Stasm4 REQUIRED) diff --git a/openbr/plugins/imgproc/cvt.cpp b/openbr/plugins/imgproc/cvt.cpp new file mode 100644 index 0000000..5078669 --- /dev/null +++ b/openbr/plugins/imgproc/cvt.cpp @@ -0,0 +1,71 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 Colorspace conversion. + * \author Josh Klontz \cite jklontz + */ +class CvtTransform : public UntrainableTransform +{ + Q_OBJECT + Q_ENUMS(ColorSpace) + Q_PROPERTY(ColorSpace colorSpace READ get_colorSpace WRITE set_colorSpace RESET reset_colorSpace STORED false) + Q_PROPERTY(int channel READ get_channel WRITE set_channel RESET reset_channel STORED false) + +public: + enum ColorSpace { Gray = CV_BGR2GRAY, + RGBGray = CV_RGB2GRAY, + HLS = CV_BGR2HLS, + HSV = CV_BGR2HSV, + Lab = CV_BGR2Lab, + Luv = CV_BGR2Luv, + RGB = CV_BGR2RGB, + XYZ = CV_BGR2XYZ, + YCrCb = CV_BGR2YCrCb, + Color = CV_GRAY2BGR }; + +private: + BR_PROPERTY(ColorSpace, colorSpace, Gray) + BR_PROPERTY(int, channel, -1) + + void project(const Template &src, Template &dst) const + { + if (src.m().channels() > 1 || colorSpace == CV_GRAY2BGR) cvtColor(src, dst, colorSpace); + else dst = src; + + if (channel != -1) { + std::vector mv; + split(dst, mv); + dst = mv[channel % (int)mv.size()]; + } + } +}; + +BR_REGISTER(Transform, CvtTransform) + +} // namespace br + +#include "imgproc/cvt.moc" diff --git a/openbr/plugins/imgproc/cvtcolor.cpp b/openbr/plugins/imgproc/cvtcolor.cpp deleted file mode 100644 index 6a3f7df..0000000 --- a/openbr/plugins/imgproc/cvtcolor.cpp +++ /dev/null @@ -1,71 +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 Colorspace conversion. - * \author Josh Klontz \cite jklontz - */ -class CvtColorTransform : public UntrainableTransform -{ - Q_OBJECT - Q_ENUMS(ColorSpace) - Q_PROPERTY(ColorSpace colorSpace READ get_colorSpace WRITE set_colorSpace RESET reset_colorSpace STORED false) - Q_PROPERTY(int channel READ get_channel WRITE set_channel RESET reset_channel STORED false) - -public: - enum ColorSpace { Gray = CV_BGR2GRAY, - RGBGray = CV_RGB2GRAY, - HLS = CV_BGR2HLS, - HSV = CV_BGR2HSV, - Lab = CV_BGR2Lab, - Luv = CV_BGR2Luv, - RGB = CV_BGR2RGB, - XYZ = CV_BGR2XYZ, - YCrCb = CV_BGR2YCrCb, - Color = CV_GRAY2BGR }; - -private: - BR_PROPERTY(ColorSpace, colorSpace, Gray) - BR_PROPERTY(int, channel, -1) - - void project(const Template &src, Template &dst) const - { - if (src.m().channels() > 1 || colorSpace == CV_GRAY2BGR) cvtColor(src, dst, colorSpace); - else dst = src; - - if (channel != -1) { - std::vector mv; - split(dst, mv); - dst = mv[channel % (int)mv.size()]; - } - } -}; - -BR_REGISTER(Transform, CvtColorTransform) - -} // namespace br - -#include "imgproc/cvtcolor.moc" -- libgit2 0.21.4