38#ifndef PCL_LZF_IMAGE_IO_HPP_
39#define PCL_LZF_IMAGE_IO_HPP_
41#include <pcl/console/print.h>
42#include <pcl/common/utils.h>
43#include <pcl/io/debayer.h>
51#define CLIP_CHAR(c) static_cast<unsigned char> ((c)>255?255:(c)<0?0:(c))
60template <
typename Po
intT>
bool
68 PCL_ERROR (
"[pcl::io::LZFDepth16ImageReader::read] Unable to read image data from %s.\n",
filename.c_str ());
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 ());
83 PCL_ERROR (
"[pcl::io::LZFDepth16ImageReader::read] Error uncompressing data stored in %s!\n",
filename.c_str ());
90 cloud.is_dense =
true;
95 for (std::uint32_t v = 0; v < cloud.height; ++v)
104 pt.x =
pt.y =
pt.z = std::numeric_limits<float>::quiet_NaN ();
105 cloud.is_dense =
false;
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;
125template <
typename Po
intT>
bool
134 PCL_ERROR (
"[pcl::io::LZFDepth16ImageReader::read] Unable to read image data from %s.\n",
filename.c_str ());
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 ());
149 PCL_ERROR (
"[pcl::io::LZFDepth16ImageReader::read] Error uncompressing data stored in %s!\n",
filename.c_str ());
156 cloud.is_dense =
true;
161#pragma omp parallel for \
163 shared(cloud, constant_x, constant_y, uncompressed_data) \
164 num_threads(num_threads)
170 int u = i % cloud.width;
171 int v = i / cloud.width;
178 pt.x =
pt.y =
pt.z = std::numeric_limits<float>::quiet_NaN ();
184 cloud.is_dense =
false;
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;
206template <
typename Po
intT>
bool
214 PCL_ERROR (
"[pcl::io::LZFRGB24ImageReader::read] Unable to read image data from %s.\n",
filename.c_str ());
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 ());
229 PCL_ERROR (
"[pcl::io::LZFRGB24ImageReader::read] Error uncompressing data stored in %s!\n",
filename.c_str ());
243 for (std::size_t i = 0; i < cloud.
size (); ++i, ++
rgb_idx)
255template <
typename Po
intT>
bool
263 PCL_ERROR (
"[pcl::io::LZFRGB24ImageReader::read] Unable to read image data from %s.\n",
filename.c_str ());
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 ());
278 PCL_ERROR (
"[pcl::io::LZFRGB24ImageReader::read] Error uncompressing data stored in %s!\n",
filename.c_str ());
292#pragma omp parallel for \
294 shared(cloud, color_b, color_g, color_r) \
295 num_threads(num_threads)
299 for (
long int i = 0; i < cloud.
size (); ++i)
311template <
typename Po
intT>
bool
319 PCL_ERROR (
"[pcl::io::LZFYUV422ImageReader::read] Unable to read image data from %s.\n",
filename.c_str ());
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 ());
334 PCL_ERROR (
"[pcl::io::LZFYUV422ImageReader::read] Error uncompressing data stored in %s!\n",
filename.c_str ());
349 for (
int i = 0; i <
wh2; ++i,
y_idx += 2)
356 pt1.g = CLIP_CHAR (
color_y[
y_idx + 0] + ((v * -9519 - u * 6472 + 8192) >> 14));
361 pt2.g = CLIP_CHAR (
color_y[
y_idx + 1] + ((v * -9519 - u * 6472 + 8192) >> 14));
369template <
typename Po
intT>
bool
377 PCL_ERROR (
"[pcl::io::LZFYUV422ImageReader::read] Unable to read image data from %s.\n",
filename.c_str ());
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 ());
392 PCL_ERROR (
"[pcl::io::LZFYUV422ImageReader::read] Error uncompressing data stored in %s!\n",
filename.c_str ());
407#pragma omp parallel for \
409 shared(cloud, color_u, color_v, color_y, wh2) \
410 num_threads(num_threads)
414 for (
int i = 0; i <
wh2; ++i)
422 pt1.g = CLIP_CHAR (
color_y[
y_idx + 0] + ((v * -9519 - u * 6472 + 8192) >> 14));
427 pt2.g = CLIP_CHAR (
color_y[
y_idx + 1] + ((v * -9519 - u * 6472 + 8192) >> 14));
435template <
typename Po
intT>
bool
443 PCL_ERROR (
"[pcl::io::LZFBayer8ImageReader::read] Unable to read image data from %s.\n",
filename.c_str ());
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 ());
458 PCL_ERROR (
"[pcl::io::LZFBayer8ImageReader::read] Error uncompressing data stored in %s!\n",
filename.c_str ());
473 for (std::size_t i = 0; i < cloud.
size (); ++i,
rgb_idx += 3)
485template <
typename Po
intT>
bool
493 PCL_ERROR (
"[pcl::io::LZFBayer8ImageReader::read] Unable to read image data from %s.\n",
filename.c_str ());
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 ());
508 PCL_ERROR (
"[pcl::io::LZFBayer8ImageReader::read] Error uncompressing data stored in %s!\n",
filename.c_str ());
523#pragma omp parallel for \
525 num_threads(num_threads)
529 for (
long int i = 0; i < cloud.
size (); ++i)
Iterator class for point clouds with or without given indices.
std::size_t size() const
Size of the range the iterator is going through.
Various debayering methods.
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],...
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.
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.
std::string getImageType() const
Get the type of the image read from disk.
CameraParameters parameters_
Internal set of camera parameters.
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.
A point structure representing Euclidean xyz coordinates, and the RGB color.
double principal_point_y
cy
double principal_point_x
cx