Image Component Library (ICL)
|
File Writer implementation writing images to the hard disc. More...
#include <FileWriter.h>
Public Member Functions | |
FileWriter () | |
creates an empty file writer | |
FileWriter (const std::string &filepattern) | |
Creates a new filewriter with given filepattern. | |
FileWriter (const FilenameGenerator &gen) | |
Creates a new FileWriter with given FilenameGenerator. | |
~FileWriter () | |
Destructor. | |
const FilenameGenerator & | getFilenameGenerator () const |
returns the wrapped filename generator reference | |
void | write (const core::ImgBase *image) |
writes the next image | |
virtual void | send (const core::ImgBase *image) |
wraps write to implement ImageOutput interface | |
FileWriter & | operator<< (const core::ImgBase *image) |
as write but in stream manner | |
void | setOption (const std::string &option, const std::string &value) |
sets a core::format specific option | |
Private Attributes | |
FilenameGenerator | m_oGen |
internal generator for new filenames | |
Static Private Attributes | |
static std::map< std::string, FileWriterPlugin * > | s_mapPlugins |
static map of writer plugins | |
Friends | |
class | FileWriterPluginMapInitializer |
initializer class |
File Writer implementation writing images to the hard disc.
The implementation has been re-designed to provide a structured more flexible plugin based interface for writing images using most different file formats. Currently the following formats are supported:
All supported file formats (except jpg) can be written/read as gzipped file. This feature is available if the libz is found by the makefile system, which automatically defines the -DWITH_ZLIB_SUPPORT then. To write a file with zip compression, you just have to add an additional ".gz"-suffix to the file name.
Dependent on the particular core::format, the IO process needs a larger or smaller amount of time. The following table shows a summary of the I/O Times. The times are taken on a 1.6GHz pentium-m notebook, so the actual times may fluctuate:
Writing (gz) | Reading (gz) | File-utils::Size (640x480-Parrot) (gz) | |
ppm | 10ms (100ms) | 6ms (25ms) | 901K (545K) |
pnm | 10ms (100ms) | 6ms (25ms) | 901K (545K) |
pgm | 7ms (120ms) | 7ms (25ms) | 901K (562K) |
icl | 4ms (122ms) | 7ms (26ms) | 901K (562K) |
csv | 800ms (1800ms) | 780ms (820ms) | 2901K (690K) |
jpg 10% | 5ms (not supported) | 5ms (not supported) | 15K (not supported) |
jpg 50% | 6ms (not supported) | 5ms (not supported) | 41K (not supported) |
jpg 90% | 5ms (not supported) | 5ms (not supported) | 101K (not supported) |
jpg 100% | 7ms (not supported) | 3ms (not supported) | 269K (not supported) |
The following example illustrates using the file writer:
#include <ICLIO/FileWriter.h> #include <ICLQt/Quick.h> int main(){ // create an image icl::core::Img8u a = cvt8u(scale(create("parrot"),640,480)); // create the file writer icl::io::FileWriter writer("image_####.jpg"); // write the file writer.write(&a); }
creates an empty file writer
icl::io::FileWriter::FileWriter | ( | const std::string & | filepattern | ) |
Creates a new filewriter with given filepattern.
filepattern | this string is passed to the member FilenameGenerator |
icl::io::FileWriter::FileWriter | ( | const FilenameGenerator & | gen | ) |
Creates a new FileWriter with given FilenameGenerator.
Destructor.
const FilenameGenerator& icl::io::FileWriter::getFilenameGenerator | ( | ) | const |
returns the wrapped filename generator reference
FileWriter& icl::io::FileWriter::operator<< | ( | const core::ImgBase * | image | ) |
as write but in stream manner
virtual void icl::io::FileWriter::send | ( | const core::ImgBase * | image | ) | [inline, virtual] |
wraps write to implement ImageOutput interface
Implements icl::io::ImageOutput.
void icl::io::FileWriter::setOption | ( | const std::string & | option, |
const std::string & | value | ||
) |
sets a core::format specific option
currently allowed options are:
void icl::io::FileWriter::write | ( | const core::ImgBase * | image | ) |
writes the next image
friend class FileWriterPluginMapInitializer [friend] |
initializer class
FilenameGenerator icl::io::FileWriter::m_oGen [private] |
internal generator for new filenames
std::map<std::string,FileWriterPlugin*> icl::io::FileWriter::s_mapPlugins [static, private] |
static map of writer plugins