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