123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- #ifndef _IMAGE_IMAGEFILELISTWRITER_H
- #define _IMAGE_IMAGEFILELISTWRITER_H
- #include "core/image/ImageOutputStream.h"
- #include <string>
- #include <fstream>
- #include <vector>
- namespace NICE {
- class ImageFileListWriter: public ImageOutputStream {
- public:
-
- ImageFileListWriter(const std::string& path, const std::string& extension = ".ppm", const bool _keepImagesInMemory =
- false);
-
- virtual ~ImageFileListWriter();
-
- virtual void writeColorImage(const ColorImage& image);
-
- virtual void writeGrayImage(const Image& image);
-
- virtual void flushMemoryBuffer();
- virtual void close();
- virtual void insertMissingFrames(int frames);
-
- inline const std::string& getSequenceFileName() const {
- return fileListFileName;
- }
-
- inline int currentFrameIndex() const {
- return currentFrame;
- }
-
- inline const std::string& lastImageFileName() const {
- return m_lastImageFileName;
- }
- private:
-
- std::string namePrefix;
-
- std::string nameExtension;
-
- int currentFrame;
-
- std::string fileListFileName;
-
- std::ofstream fileList;
-
- void init(const std::string& path);
-
- std::string makeCurrentFileName();
-
- void addToFileList(const std::string& fileName);
-
- bool keepImagesInMemory;
-
- std::vector<ColorImage*> images;
-
- std::vector<std::string*> fileNames;
- std::string m_lastImageFileName;
- };
- }
- #endif
|