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