Point Cloud Library (PCL)  1.14.1-dev
lzf_image_io.hpp
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 #ifndef PCL_LZF_IMAGE_IO_HPP_
39 #define PCL_LZF_IMAGE_IO_HPP_
40 
41 #include <pcl/console/print.h>
42 #include <pcl/common/utils.h> // pcl::utils::ignore
43 #include <pcl/io/debayer.h>
44 
45 #include <cstddef>
46 #include <cstdint>
47 #include <limits>
48 #include <string>
49 #include <vector>
50 
51 #define CLIP_CHAR(c) static_cast<unsigned char> ((c)>255?255:(c)<0?0:(c))
52 
53 
54 namespace pcl
55 {
56 
57 namespace io
58 {
59 
60 template <typename PointT> bool
62  const std::string &filename, pcl::PointCloud<PointT> &cloud)
63 {
64  std::uint32_t uncompressed_size;
65  std::vector<char> compressed_data;
66  if (!loadImageBlob (filename, compressed_data, uncompressed_size))
67  {
68  PCL_ERROR ("[pcl::io::LZFDepth16ImageReader::read] Unable to read image data from %s.\n", filename.c_str ());
69  return (false);
70  }
71 
72  if (uncompressed_size != getWidth () * getHeight () * 2)
73  {
74  PCL_DEBUG ("[pcl::io::LZFDepth16ImageReader::read] Uncompressed data has wrong size (%u), while in fact it should be %u bytes. \n[pcl::io::LZFDepth16ImageReader::read] Are you sure %s is a 16-bit depth PCLZF file? Identifier says: %s\n", uncompressed_size, getWidth () * getHeight () * 2, filename.c_str (), getImageType ().c_str ());
75  return (false);
76  }
77 
78  std::vector<char> uncompressed_data (uncompressed_size);
79  decompress (compressed_data, uncompressed_data);
80 
81  if (uncompressed_data.empty ())
82  {
83  PCL_ERROR ("[pcl::io::LZFDepth16ImageReader::read] Error uncompressing data stored in %s!\n", filename.c_str ());
84  return (false);
85  }
86 
87  // Copy to PointT
88  cloud.width = getWidth ();
89  cloud.height = getHeight ();
90  cloud.is_dense = true;
91  cloud.resize (getWidth () * getHeight ());
92  int depth_idx = 0, point_idx = 0;
93  double constant_x = 1.0 / parameters_.focal_length_x,
94  constant_y = 1.0 / parameters_.focal_length_y;
95  for (std::uint32_t v = 0; v < cloud.height; ++v)
96  {
97  for (std::uint32_t u = 0; u < cloud.width; ++u, ++point_idx, depth_idx += 2)
98  {
99  PointT &pt = cloud[point_idx];
100  unsigned short val;
101  memcpy (&val, &uncompressed_data[depth_idx], sizeof (unsigned short));
102  if (val == 0)
103  {
104  pt.x = pt.y = pt.z = std::numeric_limits<float>::quiet_NaN ();
105  cloud.is_dense = false;
106  continue;
107  }
108 
109  pt.z = static_cast<float> (val * z_multiplication_factor_);
110  pt.x = (static_cast<float> (u) - static_cast<float> (parameters_.principal_point_x))
111  * pt.z * static_cast<float> (constant_x);
112  pt.y = (static_cast<float> (v) - static_cast<float> (parameters_.principal_point_y))
113  * pt.z * static_cast<float> (constant_y);
114  }
115  }
116  cloud.sensor_origin_.setZero ();
117  cloud.sensor_orientation_.w () = 1.0f;
118  cloud.sensor_orientation_.x () = 0.0f;
119  cloud.sensor_orientation_.y () = 0.0f;
120  cloud.sensor_orientation_.z () = 0.0f;
121  return (true);
122 }
123 
124 
125 template <typename PointT> bool
126 LZFDepth16ImageReader::readOMP (const std::string &filename,
128  unsigned int num_threads)
129 {
130  std::uint32_t uncompressed_size;
131  std::vector<char> compressed_data;
132  if (!loadImageBlob (filename, compressed_data, uncompressed_size))
133  {
134  PCL_ERROR ("[pcl::io::LZFDepth16ImageReader::read] Unable to read image data from %s.\n", filename.c_str ());
135  return (false);
136  }
137 
138  if (uncompressed_size != getWidth () * getHeight () * 2)
139  {
140  PCL_DEBUG ("[pcl::io::LZFDepth16ImageReader::read] Uncompressed data has wrong size (%u), while in fact it should be %u bytes. \n[pcl::io::LZFDepth16ImageReader::read] Are you sure %s is a 16-bit depth PCLZF file? Identifier says: %s\n", uncompressed_size, getWidth () * getHeight () * 2, filename.c_str (), getImageType ().c_str ());
141  return (false);
142  }
143 
144  std::vector<char> uncompressed_data (uncompressed_size);
145  decompress (compressed_data, uncompressed_data);
146 
147  if (uncompressed_data.empty ())
148  {
149  PCL_ERROR ("[pcl::io::LZFDepth16ImageReader::read] Error uncompressing data stored in %s!\n", filename.c_str ());
150  return (false);
151  }
152 
153  // Copy to PointT
154  cloud.width = getWidth ();
155  cloud.height = getHeight ();
156  cloud.is_dense = true;
157  cloud.resize (getWidth () * getHeight ());
158  double constant_x = 1.0 / parameters_.focal_length_x,
159  constant_y = 1.0 / parameters_.focal_length_y;
160 #ifdef _OPENMP
161 #pragma omp parallel for \
162  default(none) \
163  shared(cloud, constant_x, constant_y, uncompressed_data) \
164  num_threads(num_threads)
165 #else
166  pcl::utils::ignore(num_threads); // suppress warning if OMP is not present
167 #endif
168  for (int i = 0; i < static_cast< int> (cloud.size ()); ++i)
169  {
170  int u = i % cloud.width;
171  int v = i / cloud.width;
172  PointT &pt = cloud[i];
173  int depth_idx = 2*i;
174  unsigned short val;
175  memcpy (&val, &uncompressed_data[depth_idx], sizeof (unsigned short));
176  if (val == 0)
177  {
178  pt.x = pt.y = pt.z = std::numeric_limits<float>::quiet_NaN ();
179  if (cloud.is_dense)
180  {
181 #pragma omp critical
182  {
183  if (cloud.is_dense)
184  cloud.is_dense = false;
185  }
186  }
187  continue;
188  }
189 
190  pt.z = static_cast<float> (val * z_multiplication_factor_);
191  pt.x = (static_cast<float> (u) - static_cast<float> (parameters_.principal_point_x))
192  * pt.z * static_cast<float> (constant_x);
193  pt.y = (static_cast<float> (v) - static_cast<float> (parameters_.principal_point_y))
194  * pt.z * static_cast<float> (constant_y);
195  }
196 
197  cloud.sensor_origin_.setZero ();
198  cloud.sensor_orientation_.w () = 1.0f;
199  cloud.sensor_orientation_.x () = 0.0f;
200  cloud.sensor_orientation_.y () = 0.0f;
201  cloud.sensor_orientation_.z () = 0.0f;
202  return (true);
203 }
204 
205 
206 template <typename PointT> bool
208  const std::string &filename, pcl::PointCloud<PointT> &cloud)
209 {
210  std::uint32_t uncompressed_size;
211  std::vector<char> compressed_data;
212  if (!loadImageBlob (filename, compressed_data, uncompressed_size))
213  {
214  PCL_ERROR ("[pcl::io::LZFRGB24ImageReader::read] Unable to read image data from %s.\n", filename.c_str ());
215  return (false);
216  }
217 
218  if (uncompressed_size != getWidth () * getHeight () * 3)
219  {
220  PCL_DEBUG ("[pcl::io::LZFRGB24ImageReader::read] Uncompressed data has wrong size (%u), while in fact it should be %u bytes. \n[pcl::io::LZFRGB24ImageReader::read] Are you sure %s is a 24-bit RGB PCLZF file? Identifier says: %s\n", uncompressed_size, getWidth () * getHeight () * 3, filename.c_str (), getImageType ().c_str ());
221  return (false);
222  }
223 
224  std::vector<char> uncompressed_data (uncompressed_size);
225  decompress (compressed_data, uncompressed_data);
226 
227  if (uncompressed_data.empty ())
228  {
229  PCL_ERROR ("[pcl::io::LZFRGB24ImageReader::read] Error uncompressing data stored in %s!\n", filename.c_str ());
230  return (false);
231  }
232 
233  // Copy to PointT
234  cloud.width = getWidth ();
235  cloud.height = getHeight ();
236  cloud.resize (getWidth () * getHeight ());
237 
238  int rgb_idx = 0;
239  auto *color_r = reinterpret_cast<unsigned char*> (uncompressed_data.data());
240  auto *color_g = reinterpret_cast<unsigned char*> (&uncompressed_data[getWidth () * getHeight ()]);
241  auto *color_b = reinterpret_cast<unsigned char*> (&uncompressed_data[2 * getWidth () * getHeight ()]);
242 
243  for (std::size_t i = 0; i < cloud.size (); ++i, ++rgb_idx)
244  {
245  PointT &pt = cloud[i];
246 
247  pt.b = color_b[rgb_idx];
248  pt.g = color_g[rgb_idx];
249  pt.r = color_r[rgb_idx];
250  }
251  return (true);
252 }
253 
254 
255 template <typename PointT> bool
257  const std::string &filename, pcl::PointCloud<PointT> &cloud, unsigned int num_threads)
258 {
259  std::uint32_t uncompressed_size;
260  std::vector<char> compressed_data;
261  if (!loadImageBlob (filename, compressed_data, uncompressed_size))
262  {
263  PCL_ERROR ("[pcl::io::LZFRGB24ImageReader::read] Unable to read image data from %s.\n", filename.c_str ());
264  return (false);
265  }
266 
267  if (uncompressed_size != getWidth () * getHeight () * 3)
268  {
269  PCL_DEBUG ("[pcl::io::LZFRGB24ImageReader::read] Uncompressed data has wrong size (%u), while in fact it should be %u bytes. \n[pcl::io::LZFRGB24ImageReader::read] Are you sure %s is a 24-bit RGB PCLZF file? Identifier says: %s\n", uncompressed_size, getWidth () * getHeight () * 3, filename.c_str (), getImageType ().c_str ());
270  return (false);
271  }
272 
273  std::vector<char> uncompressed_data (uncompressed_size);
274  decompress (compressed_data, uncompressed_data);
275 
276  if (uncompressed_data.empty ())
277  {
278  PCL_ERROR ("[pcl::io::LZFRGB24ImageReader::read] Error uncompressing data stored in %s!\n", filename.c_str ());
279  return (false);
280  }
281 
282  // Copy to PointT
283  cloud.width = getWidth ();
284  cloud.height = getHeight ();
285  cloud.resize (getWidth () * getHeight ());
286 
287  auto *color_r = reinterpret_cast<unsigned char*> (uncompressed_data.data());
288  auto *color_g = reinterpret_cast<unsigned char*> (&uncompressed_data[getWidth () * getHeight ()]);
289  auto *color_b = reinterpret_cast<unsigned char*> (&uncompressed_data[2 * getWidth () * getHeight ()]);
290 
291 #ifdef _OPENMP
292 #pragma omp parallel for \
293  default(none) \
294  shared(cloud, color_b, color_g, color_r) \
295  num_threads(num_threads)
296 #else
297  pcl::utils::ignore(num_threads); // suppress warning if OMP is not present
298 #endif//_OPENMP
299  for (long int i = 0; i < cloud.size (); ++i)
300  {
301  PointT &pt = cloud[i];
302 
303  pt.b = color_b[i];
304  pt.g = color_g[i];
305  pt.r = color_r[i];
306  }
307  return (true);
308 }
309 
310 
311 template <typename PointT> bool
313  const std::string &filename, pcl::PointCloud<PointT> &cloud)
314 {
315  std::uint32_t uncompressed_size;
316  std::vector<char> compressed_data;
317  if (!loadImageBlob (filename, compressed_data, uncompressed_size))
318  {
319  PCL_ERROR ("[pcl::io::LZFYUV422ImageReader::read] Unable to read image data from %s.\n", filename.c_str ());
320  return (false);
321  }
322 
323  if (uncompressed_size != getWidth () * getHeight () * 2)
324  {
325  PCL_DEBUG ("[pcl::io::LZFYUV422ImageReader::read] Uncompressed data has wrong size (%u), while in fact it should be %u bytes. \n[pcl::io::LZFYUV422ImageReader::read] Are you sure %s is a 16-bit YUV422 PCLZF file? Identifier says: %s\n", uncompressed_size, getWidth () * getHeight (), filename.c_str (), getImageType ().c_str ());
326  return (false);
327  }
328 
329  std::vector<char> uncompressed_data (uncompressed_size);
330  decompress (compressed_data, uncompressed_data);
331 
332  if (uncompressed_data.empty ())
333  {
334  PCL_ERROR ("[pcl::io::LZFYUV422ImageReader::read] Error uncompressing data stored in %s!\n", filename.c_str ());
335  return (false);
336  }
337 
338  // Convert YUV422 to RGB24 and copy to PointT
339  cloud.width = getWidth ();
340  cloud.height = getHeight ();
341  cloud.resize (getWidth () * getHeight ());
342 
343  int wh2 = getWidth () * getHeight () / 2;
344  auto *color_u = reinterpret_cast<unsigned char*> (uncompressed_data.data());
345  auto *color_y = reinterpret_cast<unsigned char*> (&uncompressed_data[wh2]);
346  auto *color_v = reinterpret_cast<unsigned char*> (&uncompressed_data[wh2 + getWidth () * getHeight ()]);
347 
348  int y_idx = 0;
349  for (int i = 0; i < wh2; ++i, y_idx += 2)
350  {
351  int v = color_v[i] - 128;
352  int u = color_u[i] - 128;
353 
354  PointT &pt1 = cloud[y_idx + 0];
355  pt1.r = CLIP_CHAR (color_y[y_idx + 0] + ((v * 18678 + 8192 ) >> 14));
356  pt1.g = CLIP_CHAR (color_y[y_idx + 0] + ((v * -9519 - u * 6472 + 8192) >> 14));
357  pt1.b = CLIP_CHAR (color_y[y_idx + 0] + ((u * 33292 + 8192 ) >> 14));
358 
359  PointT &pt2 = cloud[y_idx + 1];
360  pt2.r = CLIP_CHAR (color_y[y_idx + 1] + ((v * 18678 + 8192 ) >> 14));
361  pt2.g = CLIP_CHAR (color_y[y_idx + 1] + ((v * -9519 - u * 6472 + 8192) >> 14));
362  pt2.b = CLIP_CHAR (color_y[y_idx + 1] + ((u * 33292 + 8192 ) >> 14));
363  }
364 
365  return (true);
366 }
367 
368 
369 template <typename PointT> bool
371  const std::string &filename, pcl::PointCloud<PointT> &cloud, unsigned int num_threads)
372 {
373  std::uint32_t uncompressed_size;
374  std::vector<char> compressed_data;
375  if (!loadImageBlob (filename, compressed_data, uncompressed_size))
376  {
377  PCL_ERROR ("[pcl::io::LZFYUV422ImageReader::read] Unable to read image data from %s.\n", filename.c_str ());
378  return (false);
379  }
380 
381  if (uncompressed_size != getWidth () * getHeight () * 2)
382  {
383  PCL_DEBUG ("[pcl::io::LZFYUV422ImageReader::read] Uncompressed data has wrong size (%u), while in fact it should be %u bytes. \n[pcl::io::LZFYUV422ImageReader::read] Are you sure %s is a 16-bit YUV422 PCLZF file? Identifier says: %s\n", uncompressed_size, getWidth () * getHeight (), filename.c_str (), getImageType ().c_str ());
384  return (false);
385  }
386 
387  std::vector<char> uncompressed_data (uncompressed_size);
388  decompress (compressed_data, uncompressed_data);
389 
390  if (uncompressed_data.empty ())
391  {
392  PCL_ERROR ("[pcl::io::LZFYUV422ImageReader::read] Error uncompressing data stored in %s!\n", filename.c_str ());
393  return (false);
394  }
395 
396  // Convert YUV422 to RGB24 and copy to PointT
397  cloud.width = getWidth ();
398  cloud.height = getHeight ();
399  cloud.resize (getWidth () * getHeight ());
400 
401  int wh2 = getWidth () * getHeight () / 2;
402  auto *color_u = reinterpret_cast<unsigned char*> (uncompressed_data.data());
403  auto *color_y = reinterpret_cast<unsigned char*> (&uncompressed_data[wh2]);
404  auto *color_v = reinterpret_cast<unsigned char*> (&uncompressed_data[wh2 + getWidth () * getHeight ()]);
405 
406 #ifdef _OPENMP
407 #pragma omp parallel for \
408  default(none) \
409  shared(cloud, color_u, color_v, color_y, wh2) \
410  num_threads(num_threads)
411 #else
412  pcl::utils::ignore(num_threads); //suppress warning if OMP is not present
413 #endif//_OPENMP
414  for (int i = 0; i < wh2; ++i)
415  {
416  int y_idx = 2*i;
417  int v = color_v[i] - 128;
418  int u = color_u[i] - 128;
419 
420  PointT &pt1 = cloud[y_idx + 0];
421  pt1.r = CLIP_CHAR (color_y[y_idx + 0] + ((v * 18678 + 8192 ) >> 14));
422  pt1.g = CLIP_CHAR (color_y[y_idx + 0] + ((v * -9519 - u * 6472 + 8192) >> 14));
423  pt1.b = CLIP_CHAR (color_y[y_idx + 0] + ((u * 33292 + 8192 ) >> 14));
424 
425  PointT &pt2 = cloud[y_idx + 1];
426  pt2.r = CLIP_CHAR (color_y[y_idx + 1] + ((v * 18678 + 8192 ) >> 14));
427  pt2.g = CLIP_CHAR (color_y[y_idx + 1] + ((v * -9519 - u * 6472 + 8192) >> 14));
428  pt2.b = CLIP_CHAR (color_y[y_idx + 1] + ((u * 33292 + 8192 ) >> 14));
429  }
430 
431  return (true);
432 }
433 
434 
435 template <typename PointT> bool
437  const std::string &filename, pcl::PointCloud<PointT> &cloud)
438 {
439  std::uint32_t uncompressed_size;
440  std::vector<char> compressed_data;
441  if (!loadImageBlob (filename, compressed_data, uncompressed_size))
442  {
443  PCL_ERROR ("[pcl::io::LZFBayer8ImageReader::read] Unable to read image data from %s.\n", filename.c_str ());
444  return (false);
445  }
446 
447  if (uncompressed_size != getWidth () * getHeight ())
448  {
449  PCL_DEBUG ("[pcl::io::LZFBayer8ImageReader::read] Uncompressed data has wrong size (%u), while in fact it should be %u bytes. \n[pcl::io::LZFBayer8ImageReader::read] Are you sure %s is a 8-bit Bayer PCLZF file? Identifier says: %s\n", uncompressed_size, getWidth () * getHeight (), filename.c_str (), getImageType ().c_str ());
450  return (false);
451  }
452 
453  std::vector<char> uncompressed_data (uncompressed_size);
454  decompress (compressed_data, uncompressed_data);
455 
456  if (uncompressed_data.empty ())
457  {
458  PCL_ERROR ("[pcl::io::LZFBayer8ImageReader::read] Error uncompressing data stored in %s!\n", filename.c_str ());
459  return (false);
460  }
461 
462  // Convert Bayer8 to RGB24
463  std::vector<unsigned char> rgb_buffer (getWidth () * getHeight () * 3);
464  DeBayer i;
465  i.debayerEdgeAware (reinterpret_cast<unsigned char*> (uncompressed_data.data()),
466  static_cast<unsigned char*> (rgb_buffer.data()),
467  getWidth (), getHeight ());
468  // Copy to PointT
469  cloud.width = getWidth ();
470  cloud.height = getHeight ();
471  cloud.resize (getWidth () * getHeight ());
472  int rgb_idx = 0;
473  for (std::size_t i = 0; i < cloud.size (); ++i, rgb_idx += 3)
474  {
475  PointT &pt = cloud[i];
476 
477  pt.b = rgb_buffer[rgb_idx + 2];
478  pt.g = rgb_buffer[rgb_idx + 1];
479  pt.r = rgb_buffer[rgb_idx + 0];
480  }
481  return (true);
482 }
483 
484 
485 template <typename PointT> bool
487  const std::string &filename, pcl::PointCloud<PointT> &cloud, unsigned int num_threads)
488 {
489  std::uint32_t uncompressed_size;
490  std::vector<char> compressed_data;
491  if (!loadImageBlob (filename, compressed_data, uncompressed_size))
492  {
493  PCL_ERROR ("[pcl::io::LZFBayer8ImageReader::read] Unable to read image data from %s.\n", filename.c_str ());
494  return (false);
495  }
496 
497  if (uncompressed_size != getWidth () * getHeight ())
498  {
499  PCL_DEBUG ("[pcl::io::LZFBayer8ImageReader::read] Uncompressed data has wrong size (%u), while in fact it should be %u bytes. \n[pcl::io::LZFBayer8ImageReader::read] Are you sure %s is a 8-bit Bayer PCLZF file? Identifier says: %s\n", uncompressed_size, getWidth () * getHeight (), filename.c_str (), getImageType ().c_str ());
500  return (false);
501  }
502 
503  std::vector<char> uncompressed_data (uncompressed_size);
504  decompress (compressed_data, uncompressed_data);
505 
506  if (uncompressed_data.empty ())
507  {
508  PCL_ERROR ("[pcl::io::LZFBayer8ImageReader::read] Error uncompressing data stored in %s!\n", filename.c_str ());
509  return (false);
510  }
511 
512  // Convert Bayer8 to RGB24
513  std::vector<unsigned char> rgb_buffer (getWidth () * getHeight () * 3);
514  DeBayer i;
515  i.debayerEdgeAware (reinterpret_cast<unsigned char*> (uncompressed_data.data()),
516  static_cast<unsigned char*> (rgb_buffer.data()),
517  getWidth (), getHeight ());
518  // Copy to PointT
519  cloud.width = getWidth ();
520  cloud.height = getHeight ();
521  cloud.resize (getWidth () * getHeight ());
522 #ifdef _OPENMP
523 #pragma omp parallel for \
524  default(none) \
525  num_threads(num_threads)
526 #else
527  pcl::utils::ignore(num_threads); //suppress warning if OMP is not present
528 #endif//_OPENMP
529  for (long int i = 0; i < cloud.size (); ++i)
530  {
531  PointT &pt = cloud[i];
532  long int rgb_idx = 3*i;
533  pt.b = rgb_buffer[rgb_idx + 2];
534  pt.g = rgb_buffer[rgb_idx + 1];
535  pt.r = rgb_buffer[rgb_idx + 0];
536  }
537  return (true);
538 }
539 
540 } // namespace io
541 } // namespace pcl
542 
543 #endif //#ifndef PCL_LZF_IMAGE_IO_HPP_
544 
PointCloud represents the base class in PCL for storing collections of 3D points.
Definition: point_cloud.h:173
bool is_dense
True if no points are invalid (e.g., have NaN or Inf values in any of their floating point fields).
Definition: point_cloud.h:403
void resize(std::size_t count)
Resizes the container to contain count elements.
Definition: point_cloud.h:462
Eigen::Quaternionf sensor_orientation_
Sensor acquisition pose (rotation).
Definition: point_cloud.h:408
std::uint32_t width
The point cloud width (if organized as an image-structure).
Definition: point_cloud.h:398
std::uint32_t height
The point cloud height (if organized as an image-structure).
Definition: point_cloud.h:400
std::size_t size() const
Definition: point_cloud.h:443
Eigen::Vector4f sensor_origin_
Sensor acquisition pose (origin/translation).
Definition: point_cloud.h:406
Various debayering methods.
Definition: debayer.h:51
void debayerEdgeAware(const unsigned char *bayer_pixel, unsigned char *rgb_buffer, unsigned width, unsigned height, int bayer_line_step=0, int bayer_line_step2=0, unsigned rgb_line_step=0) const
bool readOMP(const std::string &filename, pcl::PointCloud< PointT > &cloud, unsigned int num_threads=0)
Read the data stored in a PCLZF Bayer 8bit file and convert it to a pcl::PointCloud type.
bool read(const std::string &filename, pcl::PointCloud< PointT > &cloud)
Read the data stored in a PCLZF Bayer 8bit file and convert it to a pcl::PointCloud type.
bool read(const std::string &filename, pcl::PointCloud< PointT > &cloud)
Read the data stored in a PCLZF depth file and convert it to a pcl::PointCloud type.
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:224
bool readOMP(const std::string &filename, pcl::PointCloud< PointT > &cloud, unsigned int num_threads=0)
Read the data stored in a PCLZF depth file and convert it to a pcl::PointCloud type.
std::uint32_t getWidth() const
Get the image width as read from disk.
Definition: lzf_image_io.h:117
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.
std::uint32_t getHeight() const
Get the image height as read from disk.
Definition: lzf_image_io.h:124
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
bool read(const std::string &filename, pcl::PointCloud< PointT > &cloud)
Read the data stored in a PCLZF RGB file and convert it to a pcl::PointCloud type.
bool readOMP(const std::string &filename, pcl::PointCloud< PointT > &cloud, unsigned int num_threads=0)
Read the data stored in a PCLZF RGB file and convert it to a pcl::PointCloud type.
bool read(const std::string &filename, pcl::PointCloud< PointT > &cloud)
Read the data stored in a PCLZF YUV422 16bit file and convert it to a pcl::PointCloud type.
bool readOMP(const std::string &filename, pcl::PointCloud< PointT > &cloud, unsigned int num_threads=0)
Read the data stored in a PCLZF YUV422 file and convert it to a pcl::PointCloud type.
void ignore(const T &...)
Utility function to eliminate unused variable warnings.
Definition: utils.h:62
A point structure representing Euclidean xyz coordinates, and the RGB color.