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