00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00024
00025 #ifndef QVIMAGERETARDERWORKER_H
00026 #define QVIMAGERETARDERWORKER_H
00027
00028 #include <QVImage>
00029 #include <QVWorker>
00030
00035 template <typename T, int C> class QVImageRetarderWorker: public QVWorker
00036 {
00037 private:
00038 QList< QVImage<T,C> > imageCache;
00039
00040 public:
00041 QVImageRetarderWorker(QString name, const int defaultRetardedFrames = 5, const int minRetardedFrames = 0, const int maxRetardedFrames = 255): QVWorker(name)
00042 {
00043
00044 addProperty< QVImage<T,C> >("Input image", inputFlag|outputFlag);
00045 addProperty< int >("Second image delay", inputFlag|outputFlag, defaultRetardedFrames, "Number of frames from the input image to the second", minRetardedFrames, maxRetardedFrames);
00046
00047
00048 addProperty< QVImage<T,C> >("Output image", outputFlag);
00049 }
00050
00051 void iterate()
00052 {
00053
00054 const QVImage<T,C> image = getPropertyValue< QVImage<uChar,C> >("Input image");
00055 const int secondImageDelay = getPropertyValue<int>("Second image delay");
00056
00057
00058 imageCache.append(image);
00059
00060
00061 setPropertyValue< QVImage<T,C> >("Output image", imageCache.front());
00062
00063
00064 while (imageCache.size() > secondImageDelay)
00065 imageCache.removeFirst();
00066 }
00067 };
00068 #endif