信息发布→ 登录 注册 退出

[C++][PCL]pcl在windows上安装后测试代码2

发布时间:2025-09-08

点击量:

include

include

include

include

include

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);

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;
    uint32_t rgb = (static_cast(r) << 16 |
                    static_cast(g) << 8 |
                    static_cast(b));
    point.rgb = *reinterpret_cast(&rgb);
    point_cloud_ptr->points.push_back(point);
}

if (z < 1.0)
{
    r -= 10;
    g += 10;
}

}

point_cloud_ptr->width = static_cast(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;

}

标签:# Namespace  # angle  # pc  # img  # class  # brush  # pre  # false  # float  # php  # toolbar  # windows  # using  # int  # char  # include  # while  # cos  # win  # c++  # ai  
在线客服
服务热线

服务热线

4008888355

微信咨询
二维码
返回顶部
×二维码

截屏,微信识别二维码

打开微信

微信号已复制,请打开微信添加咨询详情!