PCL-LZF image format writer. The PCL-LZF image format is nothing else but a LZF-modified compression over an existing file type (e.g., PNG). However, in certain situations, like RGB data for example, an [RGBRGB...RGB] array will be first reordered into [RR...RGG...GBB...B] in order to ensure better compression. More...
#include <lzf_image_io.h>
Public Member Functions | |
LZFImageWriter () | |
virtual bool | write (const char *data, uint32_t width, uint32_t height, const std::string &filename)=0 |
Save an image into PCL-LZF format. Virtual. | |
virtual bool | write (const char *data, uint32_t width, uint32_t height, const CameraParameters ¶meters, const std::string &filename_data, const std::string &filename_xml) |
Save an image and its camera parameters into PCL-LZF format. | |
bool | writeParameter (const double ¶meter, const std::string &tag, const std::string &filename) |
Write a single image/camera parameter to file, given an XML tag. | |
virtual bool | writeParameters (const CameraParameters ¶meters, const std::string &filename)=0 |
Write camera parameters to disk. Virtual. | |
virtual | ~LZFImageWriter () |
Protected Member Functions | |
uint32_t | compress (const char *input, uint32_t input_size, uint32_t width, uint32_t height, const std::string &image_type, char *output) |
Realtime LZF compression. | |
bool | saveImageBlob (const char *data, size_t data_size, const std::string &filename) |
Save a compressed image array to disk. |
PCL-LZF image format writer. The PCL-LZF image format is nothing else but a LZF-modified compression over an existing file type (e.g., PNG). However, in certain situations, like RGB data for example, an [RGBRGB...RGB] array will be first reordered into [RR...RGG...GBB...B] in order to ensure better compression.
The current list of compressors/decompressors include: * LZF compressed 24-bit [RR...RGG...GBB...B] data * LZF compressed 8-bit Bayer data * LZF compressed 16-bit YUV422 data * LZF compressed 16-bit depth data
Please note that files found using the above mentioned extensions will be treated as such. Inherit from this class and overwrite the I/O methods if you plan to change this behavior.
The main advantage of using the PCL-LZF image I/O routines is a very good file size versus I/O speed ratio. Tests performed using LZF, Snappy, ZIP, GZ2, BZIP2, as well as PNG, JPEG, and TIFF compression have shown that the internal PCL LZF methods provide the best score for the types of applications PCL is suited for.
Definition at line 377 of file lzf_image_io.h.
pcl::io::LZFImageWriter::LZFImageWriter | ( | ) | [inline] |
Empty constructor
Definition at line 381 of file lzf_image_io.h.
virtual pcl::io::LZFImageWriter::~LZFImageWriter | ( | ) | [inline, virtual] |
Empty destructor
Definition at line 383 of file lzf_image_io.h.
pcl::uint32_t pcl::io::LZFImageWriter::compress | ( | const char * | input, |
uint32_t | input_size, | ||
uint32_t | width, | ||
uint32_t | height, | ||
const std::string & | image_type, | ||
char * | output | ||
) | [protected] |
Realtime LZF compression.
[in] | input | the array to compress |
[in] | input_size | the size of the array to compress |
[in] | width | the with of the data array |
[in] | height | the height of the data array |
[in] | image_type | the type of the image to save. This should be an up to 16 characters string describing the data type. Examples are: "bayer8", "rgb24", "yuv422", "depth16". |
[out] | output | the compressed output array (must be pre-allocated!) |
Definition at line 119 of file lzf_image_io.cpp.
bool pcl::io::LZFImageWriter::saveImageBlob | ( | const char * | data, |
size_t | data_size, | ||
const std::string & | filename | ||
) | [protected] |
Save a compressed image array to disk.
[in] | data | the data to save |
[in] | data_size | the size of the data |
[in] | filename | the file name to write the data to |
Definition at line 64 of file lzf_image_io.cpp.
virtual bool pcl::io::LZFImageWriter::write | ( | const char * | data, |
uint32_t | width, | ||
uint32_t | height, | ||
const std::string & | filename | ||
) | [pure virtual] |
Save an image into PCL-LZF format. Virtual.
[in] | data | the array holding the image |
[in] | width | the with of the data array |
[in] | height | the height of the data array |
[in] | filename | the file name to write |
Implemented in pcl::io::LZFBayer8ImageWriter, pcl::io::LZFYUV422ImageWriter, pcl::io::LZFRGB24ImageWriter, and pcl::io::LZFDepth16ImageWriter.
virtual bool pcl::io::LZFImageWriter::write | ( | const char * | data, |
uint32_t | width, | ||
uint32_t | height, | ||
const CameraParameters & | parameters, | ||
const std::string & | filename_data, | ||
const std::string & | filename_xml | ||
) | [inline, virtual] |
Save an image and its camera parameters into PCL-LZF format.
[in] | data | the array holding the image |
[in] | width | the with of the data array |
[in] | height | the height of the data array |
[in] | parameters | the camera parameters |
[in] | filename_data | the file name to write the data to |
[in] | filename_xml | the file name to write the parameters to |
Definition at line 416 of file lzf_image_io.h.
bool pcl::io::LZFImageWriter::writeParameter | ( | const double & | parameter, |
const std::string & | tag, | ||
const std::string & | filename | ||
) |
Write a single image/camera parameter to file, given an XML tag.
[in] | parameter | the value of the parameter to write |
[in] | tag | the value of the XML tag |
[in] | filename | the file name to write |
pcl::io::LZFDepthImageWriter w; w.writeParameter (0.001, "depth.multiplication_factor", "parameters.xml");
Definition at line 189 of file lzf_image_io.cpp.
virtual bool pcl::io::LZFImageWriter::writeParameters | ( | const CameraParameters & | parameters, |
const std::string & | filename | ||
) | [pure virtual] |
Write camera parameters to disk. Virtual.
[in] | parameters | the camera parameters |
[in] | filename | the file name to write |
Implemented in pcl::io::LZFRGB24ImageWriter, and pcl::io::LZFDepth16ImageWriter.