From bfe183460c8b145ac4d3f46a856c49b20ac64490 Mon Sep 17 00:00:00 2001 From: Charles Otto Date: Sun, 11 Aug 2013 15:15:44 -0400 Subject: [PATCH] Update stream::train --- openbr/plugins/stream.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+), 0 deletions(-) diff --git a/openbr/plugins/stream.cpp b/openbr/plugins/stream.cpp index 22ee4d8..2d9f253 100644 --- a/openbr/plugins/stream.cpp +++ b/openbr/plugins/stream.cpp @@ -1014,7 +1014,27 @@ public: }; +// Semi-functional, doesn't do anything productive outside of stream::train +class CollectSets : public TimeVaryingTransform +{ + Q_OBJECT +public: + CollectSets() : TimeVaryingTransform(false, false) {} + + QList sets; + void projectUpdate(const TemplateList &src, TemplateList &dst) + { + (void) dst; + sets.append(src); + } + + void train(const TemplateList & data) + { + (void) data; + } + +}; class DirectStreamTransform : public CompositeTransform { @@ -1036,16 +1056,24 @@ public: if (end_idx == 0) return; + CollectSets collector; + // Set transforms to the start, up to end_idx QList backup = this->transforms; transforms = backup.mid(0,end_idx); + // We use collector to retain the project structure at the end of the + // truncated stream. + transforms.append(&collector); // Reinitialize, we now act as a shorter stream. init(); + QList output; for (int i=0; i < data.size(); i++) { projectUpdate(data[i], data[i]); + output.append(collector.sets); } + data = output; transforms = backup; } @@ -1062,6 +1090,7 @@ public: QList copy = data; // Project from the start to the trainable stage. subProject(copy,i); + transforms[i]->train(copy); } } -- libgit2 0.21.4