From c391c7c9be8f53c127fb6ba5c5da210c586e4cf2 Mon Sep 17 00:00:00 2001 From: Austin Van Blanton Date: Thu, 8 Aug 2013 11:25:56 -0400 Subject: [PATCH] Add DropFrames transform to skip frames in a video --- openbr/plugins/frames.cpp | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+), 0 deletions(-) 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" -- libgit2 0.21.4