Commit 736b5a2d7a435094e764ede8130aaad2e06a53e3
1 parent
d708c166
first draft of AggregateFrames transform
Showing
1 changed file
with
49 additions
and
0 deletions
openbr/plugins/frames.cpp
0 → 100644
| 1 | +#include "openbr_internal.h" | |
| 2 | + | |
| 3 | +namespace br | |
| 4 | +{ | |
| 5 | + | |
| 6 | +/*! | |
| 7 | + * \ingroup transforms | |
| 8 | + * \brief Passes along n sequential frames to the next transform. | |
| 9 | + * \author Josh Klontz \cite jklontz | |
| 10 | + * | |
| 11 | + * For a video with m frames, AggregateFrames would create a total of m-n+1 sequences ([0,n] ... [m-n+1, m]). | |
| 12 | + */ | |
| 13 | +class AggregateFrames : public TimeVaryingTransform | |
| 14 | +{ | |
| 15 | + Q_OBJECT | |
| 16 | + Q_PROPERTY(int n READ get_n WRITE set_n RESET reset_n STORED false) | |
| 17 | + BR_PROPERTY(int, n, 1) | |
| 18 | + | |
| 19 | + TemplateList buffer; | |
| 20 | + | |
| 21 | + void train(const TemplateList &data) | |
| 22 | + { | |
| 23 | + (void) data; | |
| 24 | + } | |
| 25 | + | |
| 26 | + void projectUpdate(const Template &src, Template &dst) | |
| 27 | + { | |
| 28 | + buffer.append(src); | |
| 29 | + if (buffer.size() < n) return; | |
| 30 | + foreach (const Template &t, buffer) dst.append(t); | |
| 31 | + buffer.removeFirst(); | |
| 32 | + } | |
| 33 | + | |
| 34 | + void store(QDataStream &stream) const | |
| 35 | + { | |
| 36 | + (void) stream; | |
| 37 | + } | |
| 38 | + | |
| 39 | + void load(QDataStream &stream) | |
| 40 | + { | |
| 41 | + (void) stream; | |
| 42 | + } | |
| 43 | +}; | |
| 44 | + | |
| 45 | +BR_REGISTER(Transform, AggregateFrames) | |
| 46 | + | |
| 47 | +} // namespace br | |
| 48 | + | |
| 49 | +#include "frames.moc" | ... | ... |