Point Cloud Library (PCL)
1.12.1
Toggle main menu visibility
Loading...
Searching...
No Matches
pcl
compression
organized_pointcloud_compression.h
1
/*
2
* Software License Agreement (BSD License)
3
*
4
* Point Cloud Library (PCL) - www.pointclouds.org
5
* Copyright (c) 2010-2011, Willow Garage, 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 Willow Garage, Inc. 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
* $Id$
37
*/
38
39
#pragma once
40
41
#include <
pcl/pcl_macros.h
>
42
#include <pcl/point_cloud.h>
43
44
#include <pcl/io/openni_camera/openni_shift_to_depth_conversion.h>
45
46
#include <vector>
47
48
namespace
pcl
49
{
50
namespace
io
51
{
52
/** \author Julius Kammerl (julius@kammerl.de)
53
*/
54
template
<
typename
Po
int
T>
55
class
OrganizedPointCloudCompression
56
{
57
public
:
58
using
PointCloud
=
pcl::PointCloud<PointT>
;
59
using
PointCloudPtr
=
typename
PointCloud::Ptr
;
60
using
PointCloudConstPtr
=
typename
PointCloud::ConstPtr
;
61
62
/** \brief Empty Constructor. */
63
OrganizedPointCloudCompression
()
64
{
65
}
66
67
/** \brief Empty deconstructor. */
68
virtual
~OrganizedPointCloudCompression
()
69
{
70
}
71
72
/** \brief Encode point cloud to output stream
73
* \param[in] cloud_arg: point cloud to be compressed
74
* \param[out] compressedDataOut_arg: binary output stream containing compressed data
75
* \param[in] doColorEncoding: encode color information (if available)
76
* \param[in] convertToMono: convert rgb to mono
77
* \param[in] pngLevel_arg: png compression level (default compression: -1)
78
* \param[in] bShowStatistics_arg: show statistics
79
*/
80
void
encodePointCloud
(
const
PointCloudConstPtr &cloud_arg,
81
std::ostream& compressedDataOut_arg,
82
bool
doColorEncoding =
false
,
83
bool
convertToMono =
false
,
84
bool
bShowStatistics_arg =
true
,
85
int
pngLevel_arg = -1);
86
87
/** \brief Encode raw disparity map and color image.
88
* \note Default values are configured according to the kinect/asus device specifications
89
* \param[in] disparityMap_arg: pointer to raw 16-bit disparity map
90
* \param[in] colorImage_arg: pointer to raw 8-bit rgb color image
91
* \param[in] width_arg: width of disparity map/color image
92
* \param[in] height_arg: height of disparity map/color image
93
* \param[out] compressedDataOut_arg: binary output stream containing compressed data
94
* \param[in] doColorEncoding: encode color information (if available)
95
* \param[in] convertToMono: convert rgb to mono
96
* \param[in] pngLevel_arg: png compression level (default compression: -1)
97
* \param[in] bShowStatistics_arg: show statistics
98
* \param[in] focalLength_arg focal length
99
* \param[in] disparityShift_arg disparity shift
100
* \param[in] disparityScale_arg disparity scaling
101
*/
102
void
encodeRawDisparityMapWithColorImage
( std::vector<std::uint16_t>& disparityMap_arg,
103
std::vector<std::uint8_t>& colorImage_arg,
104
std::uint32_t width_arg,
105
std::uint32_t height_arg,
106
std::ostream& compressedDataOut_arg,
107
bool
doColorEncoding =
false
,
108
bool
convertToMono =
false
,
109
bool
bShowStatistics_arg =
true
,
110
int
pngLevel_arg = -1,
111
float
focalLength_arg = 525.0f,
112
float
disparityShift_arg = 174.825f,
113
float
disparityScale_arg = -0.161175f);
114
115
/** \brief Decode point cloud from input stream
116
* \param[in] compressedDataIn_arg: binary input stream containing compressed data
117
* \param[out] cloud_arg: reference to decoded point cloud
118
* \param[in] bShowStatistics_arg: show compression statistics during decoding
119
* \return false if an I/O error occurred.
120
*/
121
bool
decodePointCloud
(std::istream& compressedDataIn_arg,
122
PointCloudPtr &cloud_arg,
123
bool
bShowStatistics_arg =
true
);
124
125
protected
:
126
/** \brief Analyze input point cloud and calculate the maximum depth and focal length
127
* \param[in] cloud_arg: input point cloud
128
* \param[out] maxDepth_arg: calculated maximum depth
129
* \param[out] focalLength_arg: estimated focal length
130
*/
131
void
analyzeOrganizedCloud
(PointCloudConstPtr cloud_arg,
132
float
& maxDepth_arg,
133
float
& focalLength_arg)
const
;
134
135
private
:
136
// frame header identifier
137
static
const
char
*
frameHeaderIdentifier_
;
138
139
//
140
openni_wrapper::ShiftToDepthConverter
sd_converter_;
141
};
142
143
// define frame identifier
144
template
<
typename
Po
int
T>
145
const
char
* OrganizedPointCloudCompression<PointT>::frameHeaderIdentifier_ =
"<PCL-ORG-COMPRESSED>"
;
146
}
147
}
openni_wrapper::ShiftToDepthConverter
This class provides conversion of the openni 11-bit shift data to depth;.
Definition
openni_shift_to_depth_conversion.h:53
pcl::PointCloud
PointCloud represents the base class in PCL for storing collections of 3D points.
Definition
point_cloud.h:173
pcl::PointCloud::Ptr
shared_ptr< PointCloud< PointT > > Ptr
Definition
point_cloud.h:413
pcl::PointCloud::ConstPtr
shared_ptr< const PointCloud< PointT > > ConstPtr
Definition
point_cloud.h:414
pcl::io::OrganizedPointCloudCompression::PointCloudPtr
typename PointCloud::Ptr PointCloudPtr
Definition
organized_pointcloud_compression.h:59
pcl::io::OrganizedPointCloudCompression::PointCloud
pcl::PointCloud< PointT > PointCloud
Definition
organized_pointcloud_compression.h:58
pcl::io::OrganizedPointCloudCompression::~OrganizedPointCloudCompression
virtual ~OrganizedPointCloudCompression()
Empty deconstructor.
Definition
organized_pointcloud_compression.h:68
pcl::io::OrganizedPointCloudCompression::encodePointCloud
void encodePointCloud(const PointCloudConstPtr &cloud_arg, std::ostream &compressedDataOut_arg, bool doColorEncoding=false, bool convertToMono=false, bool bShowStatistics_arg=true, int pngLevel_arg=-1)
Encode point cloud to output stream.
Definition
organized_pointcloud_compression.hpp:58
pcl::io::OrganizedPointCloudCompression::decodePointCloud
bool decodePointCloud(std::istream &compressedDataIn_arg, PointCloudPtr &cloud_arg, bool bShowStatistics_arg=true)
Decode point cloud from input stream.
Definition
organized_pointcloud_compression.hpp:268
pcl::io::OrganizedPointCloudCompression::analyzeOrganizedCloud
void analyzeOrganizedCloud(PointCloudConstPtr cloud_arg, float &maxDepth_arg, float &focalLength_arg) const
Analyze input point cloud and calculate the maximum depth and focal length.
Definition
organized_pointcloud_compression.hpp:396
pcl::io::OrganizedPointCloudCompression::PointCloudConstPtr
typename PointCloud::ConstPtr PointCloudConstPtr
Definition
organized_pointcloud_compression.h:60
pcl::io::OrganizedPointCloudCompression::encodeRawDisparityMapWithColorImage
void encodeRawDisparityMapWithColorImage(std::vector< std::uint16_t > &disparityMap_arg, std::vector< std::uint8_t > &colorImage_arg, std::uint32_t width_arg, std::uint32_t height_arg, std::ostream &compressedDataOut_arg, bool doColorEncoding=false, bool convertToMono=false, bool bShowStatistics_arg=true, int pngLevel_arg=-1, float focalLength_arg=525.0f, float disparityShift_arg=174.825f, float disparityScale_arg=-0.161175f)
Encode raw disparity map and color image.
Definition
organized_pointcloud_compression.hpp:152
pcl::io::OrganizedPointCloudCompression::OrganizedPointCloudCompression
OrganizedPointCloudCompression()
Empty Constructor.
Definition
organized_pointcloud_compression.h:63
pcl::io
Definition
io.h:484
pcl::io::frameHeaderIdentifier_
const char * OrganizedPointCloudCompression< PointT >::frameHeaderIdentifier_
Definition
organized_pointcloud_compression.h:145
pcl
Definition
convolution.h:46
pcl_macros.h
Defines all the PCL and non-PCL macros used.