diff --git a/openbr/plugins/regions.cpp b/openbr/plugins/regions.cpp index 526e8cd..58a502b 100644 --- a/openbr/plugins/regions.cpp +++ b/openbr/plugins/regions.cpp @@ -112,6 +112,45 @@ BR_REGISTER(Transform, CatTransform) /*! * \ingroup transforms + * \brief Group all input matrices into a single matrix. + * + * Similar to CatTransfrom but groups every _size_ adjacent matricies. + * \author Josh Klontz \cite jklontz + */ +class GroupTransform : public UntrainableMetaTransform +{ + Q_OBJECT + Q_PROPERTY(int size READ get_size WRITE set_size RESET reset_size) + BR_PROPERTY(int, size, 1) + + void project(const Template &src, Template &dst) const + { + dst.file = src.file; + + if (src.size() % size != 0) + qFatal("%d size does not evenly divide %d matrices.", size, src.size()); + QVector sizes(src.size() / size, 0); + for (int i=0; i offsets(src.size() / size, 0); + for (int i=0; i