点云技术相关产学研社区

 找回密码
 立即注册加入PCL中国点云技术相关产学研社区

扫一扫,访问微社区

查看: 5573|回复: 4

updatePointCloud和RemovePointCloud会崩溃

[复制链接]
发表于 2016-6-7 17:37:29 | 显示全部楼层 |阅读模式
为什么我用updatePointCloud和RemovePointCloud会崩溃,谁有自己可以运行的例子,我试试是不是我的VTK本身有问题。
回复

使用道具 举报

发表于 2016-6-7 17:49:36 | 显示全部楼层
你写的是多线程应用吗,可以上点代码
回复 支持 反对

使用道具 举报

 楼主| 发表于 2016-6-7 17:54:16 | 显示全部楼层
不是,就是最简单的例子,几行代码,到updatePointCloud和RemovePointCloud那里都会崩掉。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2016-6-7 17:55:23 | 显示全部楼层
        boost::shared_ptr<pcl::visualization::PCLVisualizer> viewer(new pcl::visualization::PCLVisualizer("Normals"));

        pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);
        pcl::PointCloud<pcl::PointXYZ>::Ptr cloud111(new pcl::PointCloud<pcl::PointXYZ>);
        for (int i = 0; i < 10; i++) {
                pcl::PointXYZ point;
                point.x = point.y = point.z = i;
                cloud->push_back(point);
        }
        pcl::copyPointCloud(*cloud, *cloud111);

        std::cout << viewer->removeAllPointClouds() << std::endl;
        std::string str = "cloud";
        viewer->addPointCloud<pcl::PointXYZ>(cloud, str);
        viewer->addPointCloud<pcl::PointXYZ>(cloud, "cloud1");
        viewer->setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 3, "cloud");
        std::cout << viewer->removePointCloud("111") << std::endl;
        std::cout << viewer->updatePointCloud<pcl::PointXYZ>(cloud111, "cloud111") << std::endl;
        std::cout << viewer->updatePointCloud(cloud, str) << std::endl;
        std::cout << viewer->removePointCloud(str) << std::endl;
        std::cout << viewer->removeAllPointClouds() << std::endl;

        while (!viewer->wasStopped()) {
                viewer->spinOnce(100);
                boost::this_thread::sleep(boost::posix_time::microseconds(100000));
        }

没有点云或是点云id不存在时都没事,就是有这个点云id的时候就崩掉了。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2016-6-8 14:52:16 | 显示全部楼层
已找人验证,代码没有问题。
回复 支持 反对

使用道具 举报

本版积分规则

QQ|小黑屋|点云技术相关产学研社区 ( 陕ICP备13001629号 )

GMT+8, 2024-5-13 05:26 , Processed in 1.133465 second(s), 17 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表