using namespace std;
int main(int argc, char** argv) { pcl::PointCloud<:pointxyzrgb>::Ptr point_cloud_ptr(new pcl::PointCloud<:pointxyzrgb>); uint8_t r(255), g(15), b(15);
<pre class="brush:php;toolbar:false;">for (float z(-1.0); z <= 1.0; z += 0.05)
{
for (float angle(0.0); angle <= 360.0; angle += 5.0)
{
pcl::PointXYZRGB point;
point.x = 0.5 * cosf(pcl::deg2rad(angle));
point.y = sinf(pcl::deg2rad(angle));
point.z = z;
<pre class="brush:php;toolbar:false;"><pre class="brush:php;toolbar:false;"> uint32_t rgb = (static_cast<uint32_t>(r) << 16 |
static_cast<uint32_t>(g) << 8 |
static_cast<uint32_t>(b));
point.rgb = *reinterpret_cast<float*>(&rgb);
point_cloud_ptr->points.push_back(point);
}
if (z < 1.0)
{
r -= 10;
g += 10;
}}
point_cloud_ptr->width = static_cast<uint32_t>(point_cloud_ptr->points.size()); point_cloud_ptr->height = 1;
pcl::visualization::CloudViewer viewer("result"); viewer.showCloud(point_cloud_ptr);
while (!viewer.wasStopped()) {}
return 0;
}
![[C++][PCL]pcl在windows上安装后测试代码2](https://img.php.cn/upload/article/001/503/042/175729236682144.jpg)
立即学习“C++免费学习笔记(深入)”;
以上就是[C++][PCL]pcl在windows上安装后测试代码2的详细内容,更多请关注php中文网其它相关文章!
Windows激活工具是正版认证的激活工具,永久激活,一键解决windows许可证即将过期。可激活win7系统、win8.1系统、win10系统、win11系统。下载后先看完视频激活教程,再进行操作,100%激活成功。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号