# color_coding.h
namespace pcl
{
namespace octree
{
using namespace std;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/** \brief @b ColorCoding class
* \note This class encodes 8-bit color information for octree-based point cloud compression.
* \note
* \note typename: PointT: type of point used in pointcloud
* \author Julius Kammerl (julius@kammerl.de)
*/
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template<typename PointT>
class ColorCoding
{
// public typedefs
typedef pcl::PointCloud<PointT> PointCloud;
typedef boost::shared_ptr<PointCloud> PointCloudPtr;
typedef boost::shared_ptr<const PointCloud> PointCloudConstPtr;
public:
/** \brief Constructor.
*
* */
ColorCoding () :
output_ (), pointAvgColorDataVector_ (), pointAvgColorDataVector_Iterator_ (),
pointDiffColorDataVector_ (), pointDiffColorDataVector_Iterator_ (), colorBitReduction_ (0)
{
}
/** \brief Empty class constructor. */
virtual
~ColorCoding ()
{
}
/** \brief Define color bit depth of encoded color information.
* \param bitDepth_arg: amounts of bits for representing one color component
*/
inline
void
setBitDepth (unsigned char bitDepth_arg)
{
colorBitReduction_ = static_cast<unsigned char> (8 - bitDepth_arg);
}
/** \brief Retrieve color bit depth of encoded color information.
* \return amounts of bits for representing one color component
*/
inline unsigned char
getBitDepth ()
{
return (static_cast<unsigned char> (8 - colorBitReduction_));
}
/** \brief Set amount of voxels containing point color information and reserve memory
* \param voxelCount_arg: amounts of voxels
*/
inline void
setVoxelCount (unsigned int voxelCount_arg)
{
pointAvgColorDataVector_.reserve (voxelCount_arg * 3);
}
/** \brief Set amount of points within point cloud to be encoded and reserve memory
* \param pointCount_arg: amounts of points within point cloud
* */
inline
void
setPointCount (unsigned int pointCount_arg)
{
pointDiffColorDataVector_.reserve (pointCount_arg * 3);
}
/** \brief Initialize encoding of color information
* */
void
initializeEncoding ()
{
pointAvgColorDataVector_.clear ();
pointDiffColorDataVector_.clear ();
}
/** \brief Initialize decoding of color information
* */
void
initializeDecoding ()
{
pointAvgColorDataVector_Iterator_ = pointAvgColorDataVector_.begin ();
pointDiffColorDataVector_Iterator_ = pointDiffColorDataVector_.begin ();
}
/** \brief Get reference to vector containing averaged color data
* */
std::vector<char>&
getAverageDataVector ()
{
return pointAvgColorDataVector_;
}
/** \brief Get reference to vector containing differential color data
* */
std::vector<char>&
getDifferentialDataVector ()
{
return pointDiffColorDataVector_;
}
/** \brief Encode averaged color information for a subset of points from point cloud
* \param indexVector_arg indices defining a subset of points from points cloud
* \param rgba_offset_arg offset to color information
* \param inputCloud_arg input point cloud
* */
void
encodeAverageOfPoints (const typename std::vector<int>& indexVector_arg, unsigned char rgba_offset_arg, PointCloudConstPtr inputCloud_arg)
{
std::size_t i, len;
unsigned int avgRed;
unsigned int avgGreen;
unsigned int avgBlue;
// initialize
avgRed = avgGreen = avgBlue = 0;
// iterate over points
len = indexVector_arg.size ();
for (i = 0; i < len; i++)
{
// get color information from points
const int& idx = indexVector_arg[i];
const char* idxPointPtr = reinterpret_cast<const char*> (&inputCloud_arg->points[idx]);
const int& colorInt = *reinterpret_cast<const int*> (idxPointPtr+rgba_offset_arg);
// add color information
avgRed += (colorInt >> 0) & 0xFF;
avgGreen += (colorInt >> 8) & 0xFF;
avgBlue += (colorInt >> 16) & 0xFF;
}
// calculated average color information
if (len > 1)
{
avgRed /= static_cast<unsigned int> (len);
avgGreen /= static_cast<unsigned int> (len);
avgBlue /= static_cast<unsigned int> (len);
}
// remove least significant bits
avgRed >>= colorBitReduction_;
avgGreen >>= colorBitReduction_;
avgBlue >>= colorBitReduction_;
// add to average color vector
pointAvgColorDataVector_.push_back (static_cast<char> (avgRed));
pointAvgColorDataVector_.push_back (static_cast<char> (avgGreen));
pointAvgColorDataVector_.push_back (static_cast<char> (avgBlue));
}
/** \brief Encode color information of a subset of points from point cloud
* \param indexVector_arg indices defining a subset of points from points cloud
* \param rgba_offset_arg offset to color information
* \param inputCloud_arg input point cloud
* */
void
encodePoints (const typename std::vector<int>& indexVector_arg, unsigned char rgba_offset_arg, PointCloudConstPtr inputCloud_arg)
{
std::size_t i, len;
unsigned int avgRed;
unsigned int avgGreen;
unsigned int avgBlue;
// initialize
avgRed = avgGreen = avgBlue = 0;
// iterate over points
len = indexVector_arg.size ();
for (i = 0; i < len; i++)
{
// get color information from point
const int& idx = indexVector_arg[i];
const char* idxPointPtr = reinterpret_cast<const char*> (&inputCloud_arg->points[idx]);
const int& colorInt = *reinterpret_cast<const int*> (idxPointPtr+rgba_offset_arg);
// add color information
avgRed += (colorInt >> 0) & 0xFF;
avgGreen += (colorInt >> 8) & 0xFF;
avgBlue += (colorInt >> 16) & 0xFF;
}
if (len > 1)
{
unsigned char diffRed;
unsigned char diffGreen;
unsigned char diffBlue;
// calculated average color information
avgRed /= static_cast<unsigned int> (len);
avgGreen /= static_cast<unsigned int> (len);
avgBlue /= static_cast<unsigned int> (len);
// iterate over points for differential encoding
for (i = 0; i < len; i++)
{
const int& idx = indexVector_arg[i];
const char* idxPointPtr = reinterpret_cast<const char*> (&inputCloud_arg->points[idx]);
const int& colorInt = *reinterpret_cast<const int*> (idxPointPtr+rgba_offset_arg);
// extract color components and do XOR encoding with predicted average color
diffRed = (static_cast<unsigned char> (avgRed)) ^ static_cast<unsigned char> (((colorInt >> 0) & 0xFF));
diffGreen = (static_cast<unsigned char> (avgGreen)) ^ static_cast<unsigned char> (((colorInt >> 8) & 0xFF));
diffBlue = (static_cast<unsigned char> (avgBlue)) ^ static_cast<unsigned char> (((col
没有合适的资源?快使用搜索试试~ 我知道了~
python-pcl-master.zip_PCL-PYTHON_deeply5zj_pcl_pcl package_pytho
共508个文件
pxi:163个
pxd:71个
py:58个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 178 浏览量
2022-09-21
00:57:21
上传
评论
收藏 19.42MB ZIP 举报
温馨提示
this is pcl package code
资源推荐
资源详情
资源评论
收起资源包目录
python-pcl-master.zip_PCL-PYTHON_deeply5zj_pcl_pcl package_pytho (508个子文件)
make.bat 7KB
clear.bat 495B
translate.bat 185B
bld.bat 84B
build.bat 44B
check.bat 39B
run_with_env.cmd 3KB
PublisherPolicy1.2.config 528B
PublisherPolicy1.1.config 528B
PublisherPolicy1.4.config 528B
PublisherPolicy1.5.config 528B
PublisherPolicy1.3.config 528B
PublisherPolicy1.2.config 528B
PublisherPolicy1.1.config 528B
PublisherPolicy1.3.config 528B
minipcl.cpp 10KB
ProjectInliers.cpp 490B
grabber_callback.cpp 428B
modified_theme.css 1KB
.flake8.cython 89B
PS1080.dll 514KB
PS1080.dll 392KB
OpenNI64.dll 387KB
OpenNI.dll 306KB
OpenNI2.dll 272KB
OniFile.dll 226KB
OpenNI2.dll 215KB
nimCodecs64.dll 196KB
OniFile.dll 182KB
nimCodecs.dll 155KB
Kinect.dll 153KB
Kinect.dll 136KB
nimMockNodes64.dll 128KB
OpenNI.Net.dll 121KB
OpenNI.jni64.dll 113KB
OpenNIFilter.dll 112KB
OpenNI.Net.dll 111KB
nimRecorder64.dll 108KB
OpenNI.jni.dll 106KB
nimMockNodes.dll 94KB
nimRecorder.dll 82KB
Policy.1.5.OpenNI.Net.dll 3KB
Policy.1.4.OpenNI.Net.dll 3KB
Policy.1.2.OpenNI.Net.dll 3KB
Policy.1.3.OpenNI.Net.dll 3KB
Policy.1.1.OpenNI.Net.dll 3KB
Policy.1.2.OpenNI.Net.dll 3KB
Policy.1.3.OpenNI.Net.dll 3KB
Policy.1.1.OpenNI.Net.dll 3KB
niReg.exe 20KB
niLicense.exe 20KB
niLicense64.exe 20KB
niReg64.exe 20KB
.gitignore 310B
bfgs.h 16KB
minipcl.h 4KB
eigen.h 2KB
grabber_callback.h 640B
bind.h 284B
ProjectInliers.h 264B
shared_ptr_assign.h 257B
boost_shared_ptr_assign.h 257B
shared_ptr.hpp 539B
indexing.hpp 521B
PS1080.ini 4KB
PS1080.ini 4KB
OpenNI.ini 132B
OpenNI.ini 132B
org.OpenNI.jar 125KB
org.OpenNI.jar 119KB
LICENSE 1KB
Makefile 7KB
Makefile 591B
pcl_2d-1.8.pc 342B
table_scene_lms400.pcd 5.39MB
table_scene_lms400.pcd 5.39MB
milk_cartoon_all_small_clorox.pcd 2.43MB
table_scene_mug_stereo_textured.pcd 1.65MB
table_scene_mug_stereo_textured.pcd 1.65MB
table_scene_mug_stereo_textured_noplane.pcd 726KB
table_scene_mug_stereo_textured_noplane.pcd 726KB
bun0.pcd 590KB
flydracyl.pcd 184KB
milk.pcd 154KB
lamppost.pcd 46KB
lamppost.pcd 46KB
test_pcd.pcd 46KB
bunny.pcd 13KB
PS1080.pdb 2.65MB
PS1080.pdb 2.5MB
OpenNI2.pdb 1.5MB
OpenNI2.pdb 1.38MB
OniFile.pdb 1.22MB
OniFile.pdb 1.1MB
Kinect.pdb 883KB
Kinect.pdb 859KB
.pep8 43B
pcl_logo_958x309.png 14KB
pcl_logo.png 6KB
tutorial.po 38KB
共 508 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
JonSco
- 粉丝: 66
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功