diff --git a/openbr/plugins/frames.cpp b/openbr/plugins/frames.cpp index 74aa978..ea06dcf 100644 --- a/openbr/plugins/frames.cpp +++ b/openbr/plugins/frames.cpp @@ -48,6 +48,47 @@ private: BR_REGISTER(Transform, AggregateFrames) +/*! + * \ingroup transforms + * \brief Only use one frame every n frames. + * \author Austin Blanton \cite imaus10 + * + * For a video with m frames, DropFrames will pass on m/n frames. + */ +class DropFrames : public TimeVaryingTransform +{ + Q_OBJECT + Q_PROPERTY(int n READ get_n WRITE set_n RESET reset_n STORED false) + BR_PROPERTY(int, n, 1) + +public: + DropFrames() : TimeVaryingTransform(false) {} + +private: + void train(const TemplateList &data) + { + (void) data; + } + + void projectUpdate(const Template &src, Template &dst) + { + if (src.file.get("FrameNumber") % n != 0) return; + dst = src; + } + + void store(QDataStream &stream) const + { + (void) stream; + } + + void load(QDataStream &stream) + { + (void) stream; + } +}; + +BR_REGISTER(Transform, DropFrames) + } // namespace br #include "frames.moc"