Point Cloud Library (PCL)  1.13.1-dev
lzf_image_io.h
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Point Cloud Library (PCL) - www.pointclouds.org
5  * Copyright (c) 2012-, Open Perception, Inc.
6  *
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * * Redistributions of source code must retain the above copyright
14  * notice, this list of conditions and the following disclaimer.
15  * * Redistributions in binary form must reproduce the above
16  * copyright notice, this list of conditions and the following
17  * disclaimer in the documentation and/or other materials provided
18  * with the distribution.
19  * * Neither the name of the copyright holder(s) nor the names of its
20  * contributors may be used to endorse or promote products derived
21  * from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  * POSSIBILITY OF SUCH DAMAGE.
35  *
36  */
37 
38 #pragma once
39 
40 #include <pcl/pcl_macros.h>
41 #include <pcl/point_cloud.h>
42 #include <vector>
43 
44 namespace pcl
45 {
46  namespace io
47  {
48  /** \brief Basic camera parameters placeholder. */
50  {
51  /** fx */
53  /** fy */
55  /** cx */
57  /** cy */
59  };
60 
61  /** \brief PCL-LZF image format reader.
62  * The PCL-LZF image format is nothing else but a LZF-modified compression over
63  * an existing file type (e.g., PNG). However, in certain situations, like RGB data for
64  * example, an [RGBRGB...RGB] array will be first reordered into [RR...RGG...GBB...B]
65  * in order to ensure better compression.
66  *
67  * The current list of compressors/decompressors include:
68  * * LZF compressed 24-bit [RR...RGG...GBB...B] data
69  * * LZF compressed 8-bit Bayer data
70  * * LZF compressed 16-bit YUV422 data
71  * * LZF compressed 16-bit depth data
72  *
73  * Please note that files found using the above mentioned extensions will be treated
74  * as such. Inherit from this class and overwrite the I/O methods if you plan to change
75  * this behavior.
76  *
77  * The main advantage of using the PCL-LZF image I/O routines is a very good file size
78  * versus I/O speed ratio. Tests performed using LZF, Snappy, ZIP, GZ2, BZIP2, as well
79  * as PNG, JPEG, and TIFF compression have shown that the internal PCL LZF methods
80  * provide the best score for the types of applications PCL is suited for.
81  *
82  * \author Radu B. Rusu
83  * \ingroup io
84  */
86  {
87  public:
88  /** Empty constructor */
90  /** Empty destructor */
91  virtual ~LZFImageReader () = default;
92 
93  /** \brief Read camera parameters from a given file and store them internally.
94  * \return true if operation successful, false otherwise
95  */
96  bool
97  readParameters (const std::string &filename);
98 
99  /** \brief Read the parameters from a struct instead
100  * \param[in] parameters Camera parameters to use */
101  inline void
102  setParameters (const CameraParameters &parameters)
103  {
104  parameters_ = parameters;
105  }
106 
107  /** \brief Get the camera parameters currently being used
108  * returns a CameraParameters struct */
109  inline CameraParameters
110  getParameters () const
111  {
112  return parameters_;
113  }
114 
115  /** \brief Get the image width as read from disk. */
116  inline std::uint32_t
117  getWidth () const
118  {
119  return (width_);
120  }
121 
122  /** \brief Get the image height as read from disk. */
123  inline std::uint32_t
124  getHeight () const
125  {
126  return (height_);
127  }
128 
129  /** \brief Get the type of the image read from disk. */
130  inline std::string
131  getImageType () const
132  {
133  return (image_type_identifier_);
134  }
135 
136  protected:
137  /** \brief Read camera parameters from a given stream and store them internally.
138  * \return true if operation successful, false otherwise
139  */
140  virtual bool
141  readParameters (std::istream&) { return (false); }
142 
143  /** \brief Load a compressed image array from disk
144  * \param[in] filename the file name to load the data from
145  * \param[out] data the size of the data
146  * \param uncompressed_size
147  * \return an array filled with the data loaded from disk, NULL if error
148  */
149  bool
150  loadImageBlob (const std::string &filename,
151  std::vector<char> &data,
152  std::uint32_t &uncompressed_size);
153 
154  /** \brief Realtime LZF decompression.
155  * \param[in] input the array to decompress
156  * \param[out] output the decompressed array
157  * \return true if operation successful, false otherwise
158  */
159  bool
160  decompress (const std::vector<char> &input,
161  std::vector<char> &output);
162 
163  /** \brief The image width, as read from the file. */
164  std::uint32_t width_;
165 
166  /** \brief The image height, as read from the file. */
167  std::uint32_t height_;
168 
169  /** \brief The image type string, as read from the file. */
171 
172  /** \brief Internal set of camera parameters. */
174  };
175 
176  /** \brief PCL-LZF 16-bit depth image format reader.
177  *
178  * The main advantage of using the PCL-LZF image I/O routines is a very good file size
179  * versus I/O speed ratio. Tests performed using LZF, Snappy, ZIP, GZ2, BZIP2, as well
180  * as PNG, JPEG, and TIFF compression have shown that the internal PCL LZF methods
181  * provide the best score for the types of applications PCL is suited for.
182  *
183  * \author Radu B. Rusu
184  * \ingroup io
185  */
187  {
188  public:
190 
191  /** Empty constructor */
193  : z_multiplication_factor_ (0.001) // Set default multiplication factor
194  {}
195 
196  /** Empty destructor */
197  ~LZFDepth16ImageReader () override = default;
198 
199  /** \brief Read the data stored in a PCLZF depth file and convert it to a pcl::PointCloud type.
200  * \param[in] filename the file name to read the data from
201  * \param[out] cloud the resultant output point cloud
202  */
203  template <typename PointT> bool
204  read (const std::string &filename, pcl::PointCloud<PointT> &cloud);
205 
206  /** \brief Read the data stored in a PCLZF depth file and convert it to a pcl::PointCloud type.
207  * \param[in] filename the file name to read the data from
208  * \param[in] num_threads The number of threads to use. 0 indicates OpenMP is free to choose.
209  * \param[out] cloud the resultant output point cloud
210  */
211  template <typename PointT> bool
212  readOMP (const std::string &filename, pcl::PointCloud<PointT> &cloud,
213  unsigned int num_threads=0);
214 
215  /** \brief Read camera parameters from a given stream and store them internally.
216  * The parameters will be read from the <depth> ... </depth> tag.
217  * \return true if operation successful, false otherwise
218  */
219  bool
220  readParameters (std::istream& is) override;
221 
222  protected:
223  /** \brief Z-value depth multiplication factor
224  * (i.e., if raw data is in [mm] and we want [m], we need to multiply with 0.001)
225  */
227  };
228 
229  /** \brief PCL-LZF 24-bit RGB image format reader.
230  *
231  * The main advantage of using the PCL-LZF image I/O routines is a very good file size
232  * versus I/O speed ratio. Tests performed using LZF, Snappy, ZIP, GZ2, BZIP2, as well
233  * as PNG, JPEG, and TIFF compression have shown that the internal PCL LZF methods
234  * provide the best score for the types of applications PCL is suited for.
235  *
236  * \author Radu B. Rusu
237  * \ingroup io
238  */
240  {
241  public:
243 
244  /** Empty constructor */
245  LZFRGB24ImageReader () = default;
246  /** Empty destructor */
247  ~LZFRGB24ImageReader () override = default;
248 
249  /** \brief Read the data stored in a PCLZF RGB file and convert it to a pcl::PointCloud type.
250  * \param[in] filename the file name to read the data from
251  * \param[out] cloud the resultant output point cloud
252  */
253  template<typename PointT> bool
254  read (const std::string &filename, pcl::PointCloud<PointT> &cloud);
255 
256  /** \brief Read the data stored in a PCLZF RGB file and convert it to a pcl::PointCloud type.
257  * Note that, unless massively multithreaded, this will likely not result in a significant speedup and may even slow performance.
258  * \param[in] filename the file name to read the data from
259  * \param[in] num_threads The number of threads to use
260  * \param[out] cloud the resultant output point cloud
261  */
262  template <typename PointT> bool
263  readOMP (const std::string &filename, pcl::PointCloud<PointT> &cloud,
264  unsigned int num_threads=0);
265 
266  /** \brief Read camera parameters from a given stream and store them internally.
267  * The parameters will be read from the <rgb> ... </rgb> tag.
268  * \return true if operation successful, false otherwise
269  */
270  bool
271  readParameters (std::istream& is) override;
272 
273  protected:
274  };
275 
276  /** \brief PCL-LZF 8-bit Bayer image format reader.
277  *
278  * The main advantage of using the PCL-LZF image I/O routines is a very good file size
279  * versus I/O speed ratio. Tests performed using LZF, Snappy, ZIP, GZ2, BZIP2, as well
280  * as PNG, JPEG, and TIFF compression have shown that the internal PCL LZF methods
281  * provide the best score for the types of applications PCL is suited for.
282  *
283  * \author Radu B. Rusu
284  * \ingroup io
285  */
287  {
288  public:
290 
291  /** Empty constructor */
292  LZFYUV422ImageReader () = default;
293  /** Empty destructor */
294  ~LZFYUV422ImageReader () override = default;
295 
296  /** \brief Read the data stored in a PCLZF YUV422 16bit file and convert it to a pcl::PointCloud type.
297  * \param[in] filename the file name to read the data from
298  * \param[out] cloud the resultant output point cloud
299  */
300  template<typename PointT> bool
301  read (const std::string &filename, pcl::PointCloud<PointT> &cloud);
302 
303  /** \brief Read the data stored in a PCLZF YUV422 file and convert it to a pcl::PointCloud type.
304  * Note that, unless massively multithreaded, this will likely not result in a significant speedup
305  * \param[in] filename the file name to read the data from
306  * \param[in] num_threads The number of threads to use
307  * \param[out] cloud the resultant output point cloud
308  */
309  template <typename PointT> bool
310  readOMP (const std::string &filename, pcl::PointCloud<PointT> &cloud,
311  unsigned int num_threads=0);
312  };
313 
314  /** \brief PCL-LZF 8-bit Bayer image format reader.
315  *
316  * The main advantage of using the PCL-LZF image I/O routines is a very good file size
317  * versus I/O speed ratio. Tests performed using LZF, Snappy, ZIP, GZ2, BZIP2, as well
318  * as PNG, JPEG, and TIFF compression have shown that the internal PCL LZF methods
319  * provide the best score for the types of applications PCL is suited for.
320  *
321  * \author Radu B. Rusu
322  * \ingroup io
323  */
325  {
326  public:
328 
329  /** Empty constructor */
330  LZFBayer8ImageReader () = default;
331  /** Empty destructor */
332  ~LZFBayer8ImageReader () override = default;
333 
334  /** \brief Read the data stored in a PCLZF Bayer 8bit file and convert it to a pcl::PointCloud type.
335  * \param[in] filename the file name to read the data from
336  * \param[out] cloud the resultant output point cloud
337  */
338  template<typename PointT> bool
339  read (const std::string &filename, pcl::PointCloud<PointT> &cloud);
340 
341  /** \brief Read the data stored in a PCLZF Bayer 8bit file and convert it to a pcl::PointCloud type.
342  * Note that, unless massively multithreaded, this will likely not result in a significant speedup and may even slow performance.
343  * \param[in] filename the file name to read the data from
344  * \param[in] num_threads The number of threads to use
345  * \param[out] cloud the resultant output point cloud
346  */
347  template <typename PointT> bool
348  readOMP (const std::string &filename, pcl::PointCloud<PointT> &cloud,
349  unsigned int num_threads=0);
350  };
351 
352  /** \brief PCL-LZF image format writer.
353  * The PCL-LZF image format is nothing else but a LZF-modified compression over
354  * an existing file type (e.g., PNG). However, in certain situations, like RGB data for
355  * example, an [RGBRGB...RGB] array will be first reordered into [RR...RGG...GBB...B]
356  * in order to ensure better compression.
357  *
358  * The current list of compressors/decompressors include:
359  * * LZF compressed 24-bit [RR...RGG...GBB...B] data
360  * * LZF compressed 8-bit Bayer data
361  * * LZF compressed 16-bit YUV422 data
362  * * LZF compressed 16-bit depth data
363  *
364  * Please note that files found using the above mentioned extensions will be treated
365  * as such. Inherit from this class and overwrite the I/O methods if you plan to change
366  * this behavior.
367  *
368  * The main advantage of using the PCL-LZF image I/O routines is a very good file size
369  * versus I/O speed ratio. Tests performed using LZF, Snappy, ZIP, GZ2, BZIP2, as well
370  * as PNG, JPEG, and TIFF compression have shown that the internal PCL LZF methods
371  * provide the best score for the types of applications PCL is suited for.
372  *
373  * \author Radu B. Rusu
374  * \ingroup io
375  */
377  {
378  public:
379  /** Empty constructor */
380  LZFImageWriter () = default;
381  /** Empty destructor */
382  virtual ~LZFImageWriter () = default;
383 
384  /** \brief Save an image into PCL-LZF format. Virtual.
385  * \param[in] data the array holding the image
386  * \param[in] width the with of the data array
387  * \param[in] height the height of the data array
388  * \param[in] filename the file name to write
389  * \return true if operation successful, false otherwise
390  */
391  virtual bool
392  write (const char* data,
393  std::uint32_t width, std::uint32_t height,
394  const std::string &filename) = 0;
395 
396  /** \brief Write camera parameters to disk. Virtual.
397  * \param[in] parameters the camera parameters
398  * \param[in] filename the file name to write
399  * \return true if operation successful, false otherwise
400  */
401  virtual bool
402  writeParameters (const CameraParameters &parameters,
403  const std::string &filename) = 0;
404 
405  /** \brief Save an image and its camera parameters into PCL-LZF format.
406  * \param[in] data the array holding the image
407  * \param[in] width the with of the data array
408  * \param[in] height the height of the data array
409  * \param[in] parameters the camera parameters
410  * \param[in] filename_data the file name to write the data to
411  * \param[in] filename_xml the file name to write the parameters to
412  * \return true if operation successful, false otherwise
413  */
414  virtual bool
415  write (const char* data,
416  std::uint32_t width, std::uint32_t height,
417  const CameraParameters &parameters,
418  const std::string &filename_data,
419  const std::string &filename_xml)
420  {
421  bool res1 = write (data, width, height, filename_data);
422  bool res2 = writeParameters (parameters, filename_xml);
423  return (res1 && res2);
424  }
425 
426  /** \brief Write a single image/camera parameter to file, given an XML tag
427  * \param[in] parameter the value of the parameter to write
428  * \param[in] tag the value of the XML tag
429  * \param[in] filename the file name to write
430  * \return true if operation successful, false otherwise
431  * Example:
432  * \code
433  * pcl::io::LZFDepthImageWriter w;
434  * w.writeParameter (0.001, "depth.multiplication_factor", "parameters.xml");
435  * \endcode
436  */
437  bool
438  writeParameter (const double &parameter, const std::string &tag,
439  const std::string &filename);
440  protected:
441  /** \brief Save a compressed image array to disk
442  * \param[in] data the data to save
443  * \param[in] data_size the size of the data
444  * \param[in] filename the file name to write the data to
445  * \return true if operation successful, false otherwise
446  */
447  bool
448  saveImageBlob (const char* data, std::size_t data_size,
449  const std::string &filename);
450 
451  /** \brief Realtime LZF compression.
452  * \param[in] input the array to compress
453  * \param[in] input_size the size of the array to compress
454  * \param[in] width the with of the data array
455  * \param[in] height the height of the data array
456  * \param[in] image_type the type of the image to save. This should be an up to
457  * 16 characters string describing the data type. Examples are: "bayer8", "rgb24",
458  * "yuv422", "depth16".
459  * \param[out] output the compressed output array (must be pre-allocated!)
460  * \return the number of bytes in the output array
461  */
462  std::uint32_t
463  compress (const char* input, std::uint32_t input_size,
464  std::uint32_t width, std::uint32_t height,
465  const std::string &image_type,
466  char *output);
467  };
468 
469  /** \brief PCL-LZF 16-bit depth image format writer.
470  *
471  * The main advantage of using the PCL-LZF image I/O routines is a very good file size
472  * versus I/O speed ratio. Tests performed using LZF, Snappy, ZIP, GZ2, BZIP2, as well
473  * as PNG, JPEG, and TIFF compression have shown that the internal PCL LZF methods
474  * provide the best score for the types of applications PCL is suited for.
475  *
476  * \author Radu B. Rusu
477  * \ingroup io
478  */
480  {
481  public:
482  /** Empty constructor */
484  : z_multiplication_factor_ (0.001) // Set default multiplication factor
485  {}
486 
487  /** Empty destructor */
488  ~LZFDepth16ImageWriter () override = default;
489 
490  /** \brief Save a 16-bit depth image into PCL-LZF format.
491  * \param[in] data the array holding the depth image
492  * \param[in] width the with of the data array
493  * \param[in] height the height of the data array
494  * \param[in] filename the file name to write (preferred extension: .pclzf)
495  * \return true if operation successful, false otherwise
496  */
497  bool
498  write (const char* data,
499  std::uint32_t width, std::uint32_t height,
500  const std::string &filename) override;
501 
502  /** \brief Write camera parameters to disk.
503  * \param[in] parameters the camera parameters
504  * \param[in] filename the file name to write
505  * \return true if operation successful, false otherwise
506  * This overwrites the following parameters in the xml file, under the
507  * <depth> tag:
508  * <focal_length_x>...</focal_length_x>
509  * <focal_length_y>...</focal_length_y>
510  * <principal_point_x>...</principal_point_x>
511  * <principal_point_y>...</principal_point_y>
512  * <z_multiplication_factor>...</z_multiplication_factor>
513  */
514  bool
515  writeParameters (const CameraParameters &parameters,
516  const std::string &filename) override;
517 
518  protected:
519  /** \brief Z-value depth multiplication factor
520  * (i.e., if raw data is in [mm] and we want [m], we need to multiply with 0.001)
521  */
523  };
524 
525  /** \brief PCL-LZF 24-bit RGB image format writer.
526  *
527  * The main advantage of using the PCL-LZF image I/O routines is a very good file size
528  * versus I/O speed ratio. Tests performed using LZF, Snappy, ZIP, GZ2, BZIP2, as well
529  * as PNG, JPEG, and TIFF compression have shown that the internal PCL LZF methods
530  * provide the best score for the types of applications PCL is suited for.
531  *
532  * \author Radu B. Rusu
533  * \ingroup io
534  */
536  {
537  public:
538  /** Empty constructor */
539  LZFRGB24ImageWriter () = default;
540  /** Empty destructor */
541  ~LZFRGB24ImageWriter () override = default;
542 
543  /** \brief Save a 24-bit RGB image into PCL-LZF format.
544  * \param[in] data the array holding the RGB image (as [RGB..RGB] or [BGR..BGR])
545  * \param[in] width the with of the data array
546  * \param[in] height the height of the data array
547  * \param[in] filename the file name to write (preferred extension: .pclzf)
548  * \return true if operation successful, false otherwise
549  */
550  bool
551  write (const char *data,
552  std::uint32_t width, std::uint32_t height,
553  const std::string &filename) override;
554 
555  /** \brief Write camera parameters to disk.
556  * \param[in] parameters the camera parameters
557  * \param[in] filename the file name to write
558  * \return true if operation successful, false otherwise
559  */
560  bool
561  writeParameters (const CameraParameters &parameters,
562  const std::string &filename) override;
563 
564  protected:
565  };
566 
567  /** \brief PCL-LZF 16-bit YUV422 image format writer.
568  *
569  * The main advantage of using the PCL-LZF image I/O routines is a very good file size
570  * versus I/O speed ratio. Tests performed using LZF, Snappy, ZIP, GZ2, BZIP2, as well
571  * as PNG, JPEG, and TIFF compression have shown that the internal PCL LZF methods
572  * provide the best score for the types of applications PCL is suited for.
573  *
574  * \author Radu B. Rusu
575  * \ingroup io
576  */
578  {
579  public:
580  /** Empty constructor */
581  LZFYUV422ImageWriter () = default;
582  /** Empty destructor */
583  ~LZFYUV422ImageWriter () override = default;
584 
585  /** \brief Save a 16-bit YUV422 image into PCL-LZF format.
586  * \param[in] data the array holding the YUV422 image (as [YUYV...YUYV])
587  * \param[in] width the with of the data array
588  * \param[in] height the height of the data array
589  * \param[in] filename the file name to write (preferred extension: .pclzf)
590  * \return true if operation successful, false otherwise
591  */
592  bool
593  write (const char *data,
594  std::uint32_t width, std::uint32_t height,
595  const std::string &filename) override;
596  };
597 
598  /** \brief PCL-LZF 8-bit Bayer image format writer.
599  *
600  * The main advantage of using the PCL-LZF image I/O routines is a very good file size
601  * versus I/O speed ratio. Tests performed using LZF, Snappy, ZIP, GZ2, BZIP2, as well
602  * as PNG, JPEG, and TIFF compression have shown that the internal PCL LZF methods
603  * provide the best score for the types of applications PCL is suited for.
604  *
605  * \author Radu B. Rusu
606  * \ingroup io
607  */
609  {
610  public:
611  /** Empty constructor */
612  LZFBayer8ImageWriter () = default;
613  /** Empty destructor */
614  ~LZFBayer8ImageWriter () override = default;
615 
616  /** \brief Save a 8-bit Bayer image into PCL-LZF format.
617  * \param[in] data the array holding the 8-bit Bayer array
618  * \param[in] width the with of the data array
619  * \param[in] height the height of the data array
620  * \param[in] filename the file name to write (preferred extension: .pclzf)
621  * \return true if operation successful, false otherwise
622  */
623  bool
624  write (const char *data,
625  std::uint32_t width, std::uint32_t height,
626  const std::string &filename) override;
627  };
628  }
629 }
630 
631 #include <pcl/io/impl/lzf_image_io.hpp>
PointCloud represents the base class in PCL for storing collections of 3D points.
Definition: point_cloud.h:173
PCL-LZF 8-bit Bayer image format reader.
Definition: lzf_image_io.h:325
~LZFBayer8ImageReader() override=default
Empty destructor.
LZFBayer8ImageReader()=default
Empty constructor.
PCL-LZF 8-bit Bayer image format writer.
Definition: lzf_image_io.h:609
LZFBayer8ImageWriter()=default
Empty constructor.
~LZFBayer8ImageWriter() override=default
Empty destructor.
bool write(const char *data, std::uint32_t width, std::uint32_t height, const std::string &filename) override
Save a 8-bit Bayer image into PCL-LZF format.
PCL-LZF 16-bit depth image format reader.
Definition: lzf_image_io.h:187
LZFDepth16ImageReader()
Empty constructor.
Definition: lzf_image_io.h:192
bool readParameters(std::istream &is) override
Read camera parameters from a given stream and store them internally.
~LZFDepth16ImageReader() override=default
Empty destructor.
double z_multiplication_factor_
Z-value depth multiplication factor (i.e., if raw data is in [mm] and we want [m],...
Definition: lzf_image_io.h:226
PCL-LZF 16-bit depth image format writer.
Definition: lzf_image_io.h:480
bool write(const char *data, std::uint32_t width, std::uint32_t height, const std::string &filename) override
Save a 16-bit depth image into PCL-LZF format.
double z_multiplication_factor_
Z-value depth multiplication factor (i.e., if raw data is in [mm] and we want [m],...
Definition: lzf_image_io.h:522
bool writeParameters(const CameraParameters &parameters, const std::string &filename) override
Write camera parameters to disk.
~LZFDepth16ImageWriter() override=default
Empty destructor.
LZFDepth16ImageWriter()
Empty constructor.
Definition: lzf_image_io.h:483
PCL-LZF image format reader.
Definition: lzf_image_io.h:86
std::uint32_t getWidth() const
Get the image width as read from disk.
Definition: lzf_image_io.h:117
std::string image_type_identifier_
The image type string, as read from the file.
Definition: lzf_image_io.h:170
void setParameters(const CameraParameters &parameters)
Read the parameters from a struct instead.
Definition: lzf_image_io.h:102
virtual ~LZFImageReader()=default
Empty destructor.
bool readParameters(const std::string &filename)
Read camera parameters from a given file and store them internally.
virtual bool readParameters(std::istream &)
Read camera parameters from a given stream and store them internally.
Definition: lzf_image_io.h:141
bool decompress(const std::vector< char > &input, std::vector< char > &output)
Realtime LZF decompression.
bool loadImageBlob(const std::string &filename, std::vector< char > &data, std::uint32_t &uncompressed_size)
Load a compressed image array from disk.
LZFImageReader()
Empty constructor.
CameraParameters getParameters() const
Get the camera parameters currently being used returns a CameraParameters struct.
Definition: lzf_image_io.h:110
std::uint32_t getHeight() const
Get the image height as read from disk.
Definition: lzf_image_io.h:124
std::uint32_t width_
The image width, as read from the file.
Definition: lzf_image_io.h:164
std::string getImageType() const
Get the type of the image read from disk.
Definition: lzf_image_io.h:131
CameraParameters parameters_
Internal set of camera parameters.
Definition: lzf_image_io.h:173
std::uint32_t height_
The image height, as read from the file.
Definition: lzf_image_io.h:167
PCL-LZF image format writer.
Definition: lzf_image_io.h:377
bool saveImageBlob(const char *data, std::size_t data_size, const std::string &filename)
Save a compressed image array to disk.
virtual bool writeParameters(const CameraParameters &parameters, const std::string &filename)=0
Write camera parameters to disk.
virtual bool write(const char *data, std::uint32_t width, std::uint32_t height, const CameraParameters &parameters, const std::string &filename_data, const std::string &filename_xml)
Save an image and its camera parameters into PCL-LZF format.
Definition: lzf_image_io.h:415
bool writeParameter(const double &parameter, const std::string &tag, const std::string &filename)
Write a single image/camera parameter to file, given an XML tag.
LZFImageWriter()=default
Empty constructor.
virtual bool write(const char *data, std::uint32_t width, std::uint32_t height, const std::string &filename)=0
Save an image into PCL-LZF format.
std::uint32_t compress(const char *input, std::uint32_t input_size, std::uint32_t width, std::uint32_t height, const std::string &image_type, char *output)
Realtime LZF compression.
virtual ~LZFImageWriter()=default
Empty destructor.
PCL-LZF 24-bit RGB image format reader.
Definition: lzf_image_io.h:240
bool readParameters(const std::string &filename)
Read camera parameters from a given file and store them internally.
~LZFRGB24ImageReader() override=default
Empty destructor.
LZFRGB24ImageReader()=default
Empty constructor.
bool readParameters(std::istream &is) override
Read camera parameters from a given stream and store them internally.
PCL-LZF 24-bit RGB image format writer.
Definition: lzf_image_io.h:536
bool write(const char *data, std::uint32_t width, std::uint32_t height, const std::string &filename) override
Save a 24-bit RGB image into PCL-LZF format.
~LZFRGB24ImageWriter() override=default
Empty destructor.
bool writeParameters(const CameraParameters &parameters, const std::string &filename) override
Write camera parameters to disk.
LZFRGB24ImageWriter()=default
Empty constructor.
PCL-LZF 8-bit Bayer image format reader.
Definition: lzf_image_io.h:287
~LZFYUV422ImageReader() override=default
Empty destructor.
LZFYUV422ImageReader()=default
Empty constructor.
PCL-LZF 16-bit YUV422 image format writer.
Definition: lzf_image_io.h:578
~LZFYUV422ImageWriter() override=default
Empty destructor.
bool write(const char *data, std::uint32_t width, std::uint32_t height, const std::string &filename) override
Save a 16-bit YUV422 image into PCL-LZF format.
LZFYUV422ImageWriter()=default
Empty constructor.
void read(std::istream &stream, Type &value)
Function for reading data from a stream.
Definition: region_xy.h:46
void write(std::ostream &stream, Type value)
Function for writing data to a stream.
Definition: region_xy.h:63
Defines all the PCL and non-PCL macros used.
#define PCL_EXPORTS
Definition: pcl_macros.h:323
Basic camera parameters placeholder.
Definition: lzf_image_io.h:50