From 5032f4dbeafc767c73cc05d4f07c3bdfd6d01013 Mon Sep 17 00:00:00 2001 From: Josh Klontz Date: Thu, 21 Mar 2013 15:44:12 -0400 Subject: [PATCH] implemented Mod transform --- openbr/plugins/crop.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+), 0 deletions(-) diff --git a/openbr/plugins/crop.cpp b/openbr/plugins/crop.cpp index 456cc50..a4df76a 100644 --- a/openbr/plugins/crop.cpp +++ b/openbr/plugins/crop.cpp @@ -90,6 +90,25 @@ BR_REGISTER(Transform, LimitSizeTransform) /*! * \ingroup transforms + * \brief Enforce a multiple of \em n columns. + * \author Josh Klontz \cite jklontz + */ +class ModTransform : public UntrainableTransform +{ + Q_OBJECT + Q_PROPERTY(int n READ get_n WRITE set_n RESET reset_n STORED false) + BR_PROPERTY(int, n, 1) + + void project(const Template &src, Template &dst) const + { + dst = Mat(src, Rect(0,0,n*(src.m().cols/n),src.m().rows)); + } +}; + +BR_REGISTER(Transform, ModTransform) + +/*! + * \ingroup transforms * \brief Crop out black borders * \author Josh Klontz \cite jklontz */ -- libgit2 0.21.4