From d377e6d627661724549f530e44934b38f224c261 Mon Sep 17 00:00:00 2001 From: Josh Klontz Date: Fri, 11 Jan 2013 16:18:41 -0500 Subject: [PATCH] Generalized Cat transform --- sdk/plugins/regions.cpp | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/sdk/plugins/regions.cpp b/sdk/plugins/regions.cpp index 9d9086e..ec8f66a 100644 --- a/sdk/plugins/regions.cpp +++ b/sdk/plugins/regions.cpp @@ -79,23 +79,27 @@ BR_REGISTER(Transform, ByRow) class Cat : public UntrainableMetaTransform { Q_OBJECT + Q_PROPERTY(int partitions READ get_partitions WRITE set_partitions RESET reset_partitions) + BR_PROPERTY(int, partitions, 1) void project(const Template &src, Template &dst) const { - int vals = 0; - foreach (const cv::Mat &m, src) - vals += m.total() * m.channels(); - - Mat cat(1, (int)vals, CV_32FC1); - int offset = 0; - foreach (const cv::Mat &m, src) { - size_t size = m.total() * m.elemSize(); - memcpy(&cat.data[offset], m.ptr(), size); - offset += size; - } - dst.file = src.file; - dst = cat; + + QVector sizes(partitions, 0); + for (int i=0; i offsets(partitions, 0); + for (int i=0; i