Point Cloud Library (PCL) 1.14.0
Loading...
Searching...
No Matches
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
44namespace 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 */
85 class PCL_EXPORTS LZFImageReader
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
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
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_{0};
165
166 /** \brief The image height, as read from the file. */
167 std::uint32_t height_{0};
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 */
186 class PCL_EXPORTS LZFDepth16ImageReader : public LZFImageReader
187 {
188 public:
189 using LZFImageReader::readParameters;
190
191 /** Empty constructor */
193
194 /** Empty destructor */
195 ~LZFDepth16ImageReader () override = default;
196
197 /** \brief Read the data stored in a PCLZF depth file and convert it to a pcl::PointCloud type.
198 * \param[in] filename the file name to read the data from
199 * \param[out] cloud the resultant output point cloud
200 */
201 template <typename PointT> bool
202 read (const std::string &filename, pcl::PointCloud<PointT> &cloud);
203
204 /** \brief Read the data stored in a PCLZF depth file and convert it to a pcl::PointCloud type.
205 * \param[in] filename the file name to read the data from
206 * \param[in] num_threads The number of threads to use. 0 indicates OpenMP is free to choose.
207 * \param[out] cloud the resultant output point cloud
208 */
209 template <typename PointT> bool
210 readOMP (const std::string &filename, pcl::PointCloud<PointT> &cloud,
211 unsigned int num_threads=0);
212
213 /** \brief Read camera parameters from a given stream and store them internally.
214 * The parameters will be read from the <depth> ... </depth> tag.
215 * \return true if operation successful, false otherwise
216 */
217 bool
218 readParameters (std::istream& is) override;
219
220 protected:
221 /** \brief Z-value depth multiplication factor
222 * (i.e., if raw data is in [mm] and we want [m], we need to multiply with 0.001)
223 */
224 double z_multiplication_factor_{0.001};
225 };
226
227 /** \brief PCL-LZF 24-bit RGB image format reader.
228 *
229 * The main advantage of using the PCL-LZF image I/O routines is a very good file size
230 * versus I/O speed ratio. Tests performed using LZF, Snappy, ZIP, GZ2, BZIP2, as well
231 * as PNG, JPEG, and TIFF compression have shown that the internal PCL LZF methods
232 * provide the best score for the types of applications PCL is suited for.
233 *
234 * \author Radu B. Rusu
235 * \ingroup io
236 */
237 class PCL_EXPORTS LZFRGB24ImageReader : public LZFImageReader
238 {
239 public:
240 using LZFImageReader::readParameters;
241
242 /** Empty constructor */
244 /** Empty destructor */
245 ~LZFRGB24ImageReader () override = default;
246
247 /** \brief Read the data stored in a PCLZF RGB file and convert it to a pcl::PointCloud type.
248 * \param[in] filename the file name to read the data from
249 * \param[out] cloud the resultant output point cloud
250 */
251 template<typename PointT> bool
252 read (const std::string &filename, pcl::PointCloud<PointT> &cloud);
253
254 /** \brief Read the data stored in a PCLZF RGB file and convert it to a pcl::PointCloud type.
255 * Note that, unless massively multithreaded, this will likely not result in a significant speedup and may even slow performance.
256 * \param[in] filename the file name to read the data from
257 * \param[in] num_threads The number of threads to use
258 * \param[out] cloud the resultant output point cloud
259 */
260 template <typename PointT> bool
261 readOMP (const std::string &filename, pcl::PointCloud<PointT> &cloud,
262 unsigned int num_threads=0);
263
264 /** \brief Read camera parameters from a given stream and store them internally.
265 * The parameters will be read from the <rgb> ... </rgb> tag.
266 * \return true if operation successful, false otherwise
267 */
268 bool
269 readParameters (std::istream& is) override;
270
271 protected:
272 };
273
274 /** \brief PCL-LZF 8-bit Bayer image format reader.
275 *
276 * The main advantage of using the PCL-LZF image I/O routines is a very good file size
277 * versus I/O speed ratio. Tests performed using LZF, Snappy, ZIP, GZ2, BZIP2, as well
278 * as PNG, JPEG, and TIFF compression have shown that the internal PCL LZF methods
279 * provide the best score for the types of applications PCL is suited for.
280 *
281 * \author Radu B. Rusu
282 * \ingroup io
283 */
284 class PCL_EXPORTS LZFYUV422ImageReader : public LZFRGB24ImageReader
285 {
286 public:
287 using LZFRGB24ImageReader::readParameters;
288
289 /** Empty constructor */
291 /** Empty destructor */
292 ~LZFYUV422ImageReader () override = default;
293
294 /** \brief Read the data stored in a PCLZF YUV422 16bit file and convert it to a pcl::PointCloud type.
295 * \param[in] filename the file name to read the data from
296 * \param[out] cloud the resultant output point cloud
297 */
298 template<typename PointT> bool
299 read (const std::string &filename, pcl::PointCloud<PointT> &cloud);
300
301 /** \brief Read the data stored in a PCLZF YUV422 file and convert it to a pcl::PointCloud type.
302 * Note that, unless massively multithreaded, this will likely not result in a significant speedup
303 * \param[in] filename the file name to read the data from
304 * \param[in] num_threads The number of threads to use
305 * \param[out] cloud the resultant output point cloud
306 */
307 template <typename PointT> bool
308 readOMP (const std::string &filename, pcl::PointCloud<PointT> &cloud,
309 unsigned int num_threads=0);
310 };
311
312 /** \brief PCL-LZF 8-bit Bayer image format reader.
313 *
314 * The main advantage of using the PCL-LZF image I/O routines is a very good file size
315 * versus I/O speed ratio. Tests performed using LZF, Snappy, ZIP, GZ2, BZIP2, as well
316 * as PNG, JPEG, and TIFF compression have shown that the internal PCL LZF methods
317 * provide the best score for the types of applications PCL is suited for.
318 *
319 * \author Radu B. Rusu
320 * \ingroup io
321 */
322 class PCL_EXPORTS LZFBayer8ImageReader : public LZFRGB24ImageReader
323 {
324 public:
325 using LZFRGB24ImageReader::readParameters;
326
327 /** Empty constructor */
329 /** Empty destructor */
330 ~LZFBayer8ImageReader () override = default;
331
332 /** \brief Read the data stored in a PCLZF Bayer 8bit file and convert it to a pcl::PointCloud type.
333 * \param[in] filename the file name to read the data from
334 * \param[out] cloud the resultant output point cloud
335 */
336 template<typename PointT> bool
337 read (const std::string &filename, pcl::PointCloud<PointT> &cloud);
338
339 /** \brief Read the data stored in a PCLZF Bayer 8bit file and convert it to a pcl::PointCloud type.
340 * Note that, unless massively multithreaded, this will likely not result in a significant speedup and may even slow performance.
341 * \param[in] filename the file name to read the data from
342 * \param[in] num_threads The number of threads to use
343 * \param[out] cloud the resultant output point cloud
344 */
345 template <typename PointT> bool
346 readOMP (const std::string &filename, pcl::PointCloud<PointT> &cloud,
347 unsigned int num_threads=0);
348 };
349
350 /** \brief PCL-LZF image format writer.
351 * The PCL-LZF image format is nothing else but a LZF-modified compression over
352 * an existing file type (e.g., PNG). However, in certain situations, like RGB data for
353 * example, an [RGBRGB...RGB] array will be first reordered into [RR...RGG...GBB...B]
354 * in order to ensure better compression.
355 *
356 * The current list of compressors/decompressors include:
357 * * LZF compressed 24-bit [RR...RGG...GBB...B] data
358 * * LZF compressed 8-bit Bayer data
359 * * LZF compressed 16-bit YUV422 data
360 * * LZF compressed 16-bit depth data
361 *
362 * Please note that files found using the above mentioned extensions will be treated
363 * as such. Inherit from this class and overwrite the I/O methods if you plan to change
364 * this behavior.
365 *
366 * The main advantage of using the PCL-LZF image I/O routines is a very good file size
367 * versus I/O speed ratio. Tests performed using LZF, Snappy, ZIP, GZ2, BZIP2, as well
368 * as PNG, JPEG, and TIFF compression have shown that the internal PCL LZF methods
369 * provide the best score for the types of applications PCL is suited for.
370 *
371 * \author Radu B. Rusu
372 * \ingroup io
373 */
374 class PCL_EXPORTS LZFImageWriter
375 {
376 public:
377 /** Empty constructor */
378 LZFImageWriter () = default;
379 /** Empty destructor */
380 virtual ~LZFImageWriter () = default;
381
382 /** \brief Save an image into PCL-LZF format. Virtual.
383 * \param[in] data the array holding the image
384 * \param[in] width the with of the data array
385 * \param[in] height the height of the data array
386 * \param[in] filename the file name to write
387 * \return true if operation successful, false otherwise
388 */
389 virtual bool
390 write (const char* data,
391 std::uint32_t width, std::uint32_t height,
392 const std::string &filename) = 0;
393
394 /** \brief Write camera parameters to disk. Virtual.
395 * \param[in] parameters the camera parameters
396 * \param[in] filename the file name to write
397 * \return true if operation successful, false otherwise
398 */
399 virtual bool
401 const std::string &filename) = 0;
402
403 /** \brief Save an image and its camera parameters into PCL-LZF format.
404 * \param[in] data the array holding the image
405 * \param[in] width the with of the data array
406 * \param[in] height the height of the data array
407 * \param[in] parameters the camera parameters
408 * \param[in] filename_data the file name to write the data to
409 * \param[in] filename_xml the file name to write the parameters to
410 * \return true if operation successful, false otherwise
411 */
412 virtual bool
413 write (const char* data,
414 std::uint32_t width, std::uint32_t height,
415 const CameraParameters &parameters,
416 const std::string &filename_data,
417 const std::string &filename_xml)
418 {
419 bool res1 = write (data, width, height, filename_data);
420 bool res2 = writeParameters (parameters, filename_xml);
421 return (res1 && res2);
422 }
423
424 /** \brief Write a single image/camera parameter to file, given an XML tag
425 * \param[in] parameter the value of the parameter to write
426 * \param[in] tag the value of the XML tag
427 * \param[in] filename the file name to write
428 * \return true if operation successful, false otherwise
429 * Example:
430 * \code
431 * pcl::io::LZFDepthImageWriter w;
432 * w.writeParameter (0.001, "depth.multiplication_factor", "parameters.xml");
433 * \endcode
434 */
435 bool
436 writeParameter (const double &parameter, const std::string &tag,
437 const std::string &filename);
438 protected:
439 /** \brief Save a compressed image array to disk
440 * \param[in] data the data to save
441 * \param[in] data_size the size of the data
442 * \param[in] filename the file name to write the data to
443 * \return true if operation successful, false otherwise
444 */
445 bool
446 saveImageBlob (const char* data, std::size_t data_size,
447 const std::string &filename);
448
449 /** \brief Realtime LZF compression.
450 * \param[in] input the array to compress
451 * \param[in] input_size the size of the array to compress
452 * \param[in] width the with of the data array
453 * \param[in] height the height of the data array
454 * \param[in] image_type the type of the image to save. This should be an up to
455 * 16 characters string describing the data type. Examples are: "bayer8", "rgb24",
456 * "yuv422", "depth16".
457 * \param[out] output the compressed output array (must be pre-allocated!)
458 * \return the number of bytes in the output array
459 */
460 std::uint32_t
461 compress (const char* input, std::uint32_t input_size,
462 std::uint32_t width, std::uint32_t height,
463 const std::string &image_type,
464 char *output);
465 };
466
467 /** \brief PCL-LZF 16-bit depth image format writer.
468 *
469 * The main advantage of using the PCL-LZF image I/O routines is a very good file size
470 * versus I/O speed ratio. Tests performed using LZF, Snappy, ZIP, GZ2, BZIP2, as well
471 * as PNG, JPEG, and TIFF compression have shown that the internal PCL LZF methods
472 * provide the best score for the types of applications PCL is suited for.
473 *
474 * \author Radu B. Rusu
475 * \ingroup io
476 */
477 class PCL_EXPORTS LZFDepth16ImageWriter : public LZFImageWriter
478 {
479 public:
480 /** Empty constructor */
482
483 /** Empty destructor */
484 ~LZFDepth16ImageWriter () override = default;
485
486 /** \brief Save a 16-bit depth image into PCL-LZF format.
487 * \param[in] data the array holding the depth image
488 * \param[in] width the with of the data array
489 * \param[in] height the height of the data array
490 * \param[in] filename the file name to write (preferred extension: .pclzf)
491 * \return true if operation successful, false otherwise
492 */
493 bool
494 write (const char* data,
495 std::uint32_t width, std::uint32_t height,
496 const std::string &filename) override;
497
498 /** \brief Write camera parameters to disk.
499 * \param[in] parameters the camera parameters
500 * \param[in] filename the file name to write
501 * \return true if operation successful, false otherwise
502 * This overwrites the following parameters in the xml file, under the
503 * <depth> tag:
504 * <focal_length_x>...</focal_length_x>
505 * <focal_length_y>...</focal_length_y>
506 * <principal_point_x>...</principal_point_x>
507 * <principal_point_y>...</principal_point_y>
508 * <z_multiplication_factor>...</z_multiplication_factor>
509 */
510 bool
512 const std::string &filename) override;
513
514 protected:
515 /** \brief Z-value depth multiplication factor
516 * (i.e., if raw data is in [mm] and we want [m], we need to multiply with 0.001)
517 */
518 double z_multiplication_factor_{0.001};
519 };
520
521 /** \brief PCL-LZF 24-bit RGB image format writer.
522 *
523 * The main advantage of using the PCL-LZF image I/O routines is a very good file size
524 * versus I/O speed ratio. Tests performed using LZF, Snappy, ZIP, GZ2, BZIP2, as well
525 * as PNG, JPEG, and TIFF compression have shown that the internal PCL LZF methods
526 * provide the best score for the types of applications PCL is suited for.
527 *
528 * \author Radu B. Rusu
529 * \ingroup io
530 */
531 class PCL_EXPORTS LZFRGB24ImageWriter : public LZFImageWriter
532 {
533 public:
534 /** Empty constructor */
536 /** Empty destructor */
537 ~LZFRGB24ImageWriter () override = default;
538
539 /** \brief Save a 24-bit RGB image into PCL-LZF format.
540 * \param[in] data the array holding the RGB image (as [RGB..RGB] or [BGR..BGR])
541 * \param[in] width the with of the data array
542 * \param[in] height the height of the data array
543 * \param[in] filename the file name to write (preferred extension: .pclzf)
544 * \return true if operation successful, false otherwise
545 */
546 bool
547 write (const char *data,
548 std::uint32_t width, std::uint32_t height,
549 const std::string &filename) override;
550
551 /** \brief Write camera parameters to disk.
552 * \param[in] parameters the camera parameters
553 * \param[in] filename the file name to write
554 * \return true if operation successful, false otherwise
555 */
556 bool
558 const std::string &filename) override;
559
560 protected:
561 };
562
563 /** \brief PCL-LZF 16-bit YUV422 image format writer.
564 *
565 * The main advantage of using the PCL-LZF image I/O routines is a very good file size
566 * versus I/O speed ratio. Tests performed using LZF, Snappy, ZIP, GZ2, BZIP2, as well
567 * as PNG, JPEG, and TIFF compression have shown that the internal PCL LZF methods
568 * provide the best score for the types of applications PCL is suited for.
569 *
570 * \author Radu B. Rusu
571 * \ingroup io
572 */
573 class PCL_EXPORTS LZFYUV422ImageWriter : public LZFRGB24ImageWriter
574 {
575 public:
576 /** Empty constructor */
578 /** Empty destructor */
579 ~LZFYUV422ImageWriter () override = default;
580
581 /** \brief Save a 16-bit YUV422 image into PCL-LZF format.
582 * \param[in] data the array holding the YUV422 image (as [YUYV...YUYV])
583 * \param[in] width the with of the data array
584 * \param[in] height the height of the data array
585 * \param[in] filename the file name to write (preferred extension: .pclzf)
586 * \return true if operation successful, false otherwise
587 */
588 bool
589 write (const char *data,
590 std::uint32_t width, std::uint32_t height,
591 const std::string &filename) override;
592 };
593
594 /** \brief PCL-LZF 8-bit Bayer image format writer.
595 *
596 * The main advantage of using the PCL-LZF image I/O routines is a very good file size
597 * versus I/O speed ratio. Tests performed using LZF, Snappy, ZIP, GZ2, BZIP2, as well
598 * as PNG, JPEG, and TIFF compression have shown that the internal PCL LZF methods
599 * provide the best score for the types of applications PCL is suited for.
600 *
601 * \author Radu B. Rusu
602 * \ingroup io
603 */
604 class PCL_EXPORTS LZFBayer8ImageWriter : public LZFRGB24ImageWriter
605 {
606 public:
607 /** Empty constructor */
609 /** Empty destructor */
610 ~LZFBayer8ImageWriter () override = default;
611
612 /** \brief Save a 8-bit Bayer image into PCL-LZF format.
613 * \param[in] data the array holding the 8-bit Bayer array
614 * \param[in] width the with of the data array
615 * \param[in] height the height of the data array
616 * \param[in] filename the file name to write (preferred extension: .pclzf)
617 * \return true if operation successful, false otherwise
618 */
619 bool
620 write (const char *data,
621 std::uint32_t width, std::uint32_t height,
622 const std::string &filename) override;
623 };
624 }
625}
626
627#include <pcl/io/impl/lzf_image_io.hpp>
PointCloud represents the base class in PCL for storing collections of 3D points.
PCL-LZF 8-bit Bayer image format reader.
~LZFBayer8ImageReader() override=default
Empty destructor.
LZFBayer8ImageReader()=default
Empty constructor.
PCL-LZF 8-bit Bayer image format writer.
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.
LZFDepth16ImageReader()=default
Empty constructor.
bool readParameters(std::istream &is) override
Read camera parameters from a given stream and store them internally.
~LZFDepth16ImageReader() override=default
Empty destructor.
PCL-LZF 16-bit depth image format writer.
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.
bool writeParameters(const CameraParameters &parameters, const std::string &filename) override
Write camera parameters to disk.
~LZFDepth16ImageWriter() override=default
Empty destructor.
LZFDepth16ImageWriter()=default
Empty constructor.
PCL-LZF image format reader.
std::uint32_t getWidth() const
Get the image width as read from disk.
std::string image_type_identifier_
The image type string, as read from the file.
void setParameters(const CameraParameters &parameters)
Read the parameters from a struct instead.
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.
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.
std::uint32_t getHeight() const
Get the image height as read from disk.
std::string getImageType() const
Get the type of the image read from disk.
CameraParameters parameters_
Internal set of camera parameters.
PCL-LZF image format writer.
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.
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.
~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.
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.
~LZFYUV422ImageReader() override=default
Empty destructor.
LZFYUV422ImageReader()=default
Empty constructor.
PCL-LZF 16-bit YUV422 image format writer.
~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.
Basic camera parameters placeholder.