[CC]手动点云分割
CloudCompare中手动点云分割功能ccGraphicalSegmentationTool,
点击应用按钮后将现有的点云分成segmented和remaining两个点云,
//停用点云分割功能
void MainWindow::deactivateSegmentationMode(bool state)
是通过ccPointCloud的可视选择集来实现的。其中用到了点云的swap需要参考!
//创建新的点云,可视的选择集
ccGenericPointCloud* ccPointCloud::createNewCloudFromVisibilitySelection(bool removeSelectedPoints)
{
if (!isVisibilityTableInstantiated())
{
ccLog::Error(QString("[Cloud %1] Visibility table not instantiated!").arg(getName()));
return 0;
} //we create a new cloud with the "visible" points
ccPointCloud* result = 0;
{
//we create a temporary entity with the visible points only
CCLib::ReferenceCloud* rc = getTheVisiblePoints();
if (!rc)
{
//a warning message has already been issued by getTheVisiblePoints!
//ccLog::Warning("[ccPointCloud::createNewCloudFromVisibilitySelection] An error occurred during points selection!");
return 0;
}
assert(rc->size() != 0); //convert selection to cloud
result = partialClone(rc); //don't need this one anymore
delete rc;
rc = 0;
} if (!result)
{
ccLog::Warning("[ccPointCloud::createNewCloudFromVisibilitySelection] An error occurred during segmentation!");
return 0;
} result->setName(getName()+QString(".segmented"));//切割出来的点云 //shall the visible points be erased from this cloud?
if (removeSelectedPoints && !isLocked())
{
//we drop the octree before modifying this cloud's contents
deleteOctree();
clearLOD(); unsigned count = size(); //we have to take care of scan grids first
{
//we need a map between old and new indexes
std::vector<int> newIndexMap(size(), -1);
{
unsigned newIndex = 0;
for (unsigned i=0; i<count; ++i)
{
if (m_pointsVisibility->getValue(i) != POINT_VISIBLE)
newIndexMap[i] = newIndex++;
}
} //then update the indexes
UpdateGridIndexes(newIndexMap, m_grids); //and reset the invalid (empty) ones
//(DGM: we don't erase them as they may still be useful?)
for (size_t i=0; i<m_grids.size(); ++i)
{
Grid::Shared& scanGrid = m_grids[i];
if (scanGrid->validCount == 0)
{
scanGrid->indexes.clear();
}
}
} //we remove all visible points
unsigned lastPoint = 0;
for (unsigned i=0; i<count; ++i)
{
//i持续增长,而lastPoint遇到==POINT_VISIBLE则跳过,起到迁移的效果
if (m_pointsVisibility->getValue(i) != POINT_VISIBLE)
{
if (i != lastPoint)
swapPoints(lastPoint,i);
++lastPoint;
}
} //TODO: handle associated meshes resize(lastPoint); refreshBB(); //calls notifyGeometryUpdate + releaseVBOs
} return result;
}
调用的方法getTheVisiblePoints()
CCLib::ReferenceCloud* ccGenericPointCloud::getTheVisiblePoints() const
{
unsigned count = size();
assert(count == m_pointsVisibility->currentSize()); if (!m_pointsVisibility || m_pointsVisibility->currentSize() != count)
{
ccLog::Warning("[ccGenericPointCloud::getTheVisiblePoints] No visibility table instantiated!");
return 0;
} //count the number of points to copy
unsigned pointCount = 0;
{
for (unsigned i=0; i<count; ++i)
if (m_pointsVisibility->getValue(i) == POINT_VISIBLE)
++pointCount;
} if (pointCount == 0)
{
ccLog::Warning("[ccGenericPointCloud::getTheVisiblePoints] No point in selection");
return 0;
} //we create an entity with the 'visible' vertices only
CCLib::ReferenceCloud* rc = new CCLib::ReferenceCloud(const_cast<ccGenericPointCloud*>(this));
if (rc->reserve(pointCount))
{
for (unsigned i=0; i<count; ++i)
if (m_pointsVisibility->getValue(i) == POINT_VISIBLE)
rc->addPointIndex(i); //can't fail (see above)
}
else
{
delete rc;
rc = 0;
ccLog::Error("[ccGenericPointCloud::getTheVisiblePoints] Not enough memory!");
} return rc;
}
[CC]手动点云分割的更多相关文章
- 基于传统方法点云分割以及PCL中分割模块
之前在微信公众号中更新了以下几个章节 1,如何学习PCL以及一些基础的知识 2,PCL中IO口以及common模块的介绍 3,PCL中常用的两种数据结构KDtree以及Octree树的介绍 ...
- PCL—低层次视觉—点云分割(基于凹凸性)
1.图像分割的两条思路 场景分割时机器视觉中的重要任务,尤其对家庭机器人而言,优秀的场景分割算法是实现复杂功能的基础.但是大家搞了几十年也还没搞定——不是我说的,是接下来要介绍的这篇论文说的.图像分割 ...
- PCL点云分割(1)
点云分割是根据空间,几何和纹理等特征对点云进行划分,使得同一划分内的点云拥有相似的特征,点云的有效分割往往是许多应用的前提,例如逆向工作,CAD领域对零件的不同扫描表面进行分割,然后才能更好的进行空洞 ...
- PCL—点云分割(基于凹凸性) 低层次点云处理
博客转载自:http://www.cnblogs.com/ironstark/p/5027269.html 1.图像分割的两条思路 场景分割时机器视觉中的重要任务,尤其对家庭机器人而言,优秀的场景分割 ...
- PCL—低层次视觉—点云分割(基于形态学)
1.航空测量与点云的形态学 航空测量是对地形地貌进行测量的一种高效手段.生成地形三维形貌一直是地球学,测量学的研究重点.但对于城市,森林,等独特地形来说,航空测量会受到影响.因为土地表面的树,地面上的 ...
- PCL—低层次视觉—点云分割(超体聚类)
1.超体聚类——一种来自图像的分割方法 超体(supervoxel)是一种集合,集合的元素是“体”.与体素滤波器中的体类似,其本质是一个个的小方块.与之前提到的所有分割手段不同,超体聚类的目的并不是分 ...
- PCL—低层次视觉—点云分割(最小割算法)
1.点云分割的精度 在之前的两个章节里介绍了基于采样一致的点云分割和基于临近搜索的点云分割算法.基于采样一致的点云分割算法显然是意识流的,它只能割出大概的点云(可能是杯子的一部分,但杯把儿肯定没分割出 ...
- PCL—低层次视觉—点云分割(RanSaC)
点云分割 点云分割可谓点云处理的精髓,也是三维图像相对二维图像最大优势的体现.不过多插一句,自Niloy J Mitra教授的Global contrast based salient region ...
- segMatch:基于3D点云分割的回环检测
该论文的地址是:https://arxiv.org/pdf/1609.07720.pdf segmatch是一个提供车辆的回环检测的技术,使用提取和匹配分割的三维激光点云技术.分割的例子可以在下面的图 ...
随机推荐
- ppt - 常规策划
1 比较图2 progress3 目标 proposal4 market leadership5 分析 - 设计 - 开发 - 实施 - 评估6 innovation7 时间区间表述8 阶梯式9 主 ...
- linux内核打印数据到串口控制台,printk数据不打印问题
linux内核打印数据到串口控制台问题 原文来源:http://i.cnblogs.com/EditPosts.aspx?opt=1 1.查看当前控制台的打印级别 cat /proc/sys/kern ...
- 已解决:ECSHOP安装出现date_default_timezone_get()问题
今天在安装ECSHOP时遇到警告如下: Warning: date_default_timezone_get(): It is not safe to rely on the system's tim ...
- IDF实验室:牛刀小试
被改错的密码[从格式和长度来推测出是MD5] 迷醉..人生第一道ctf题?据说是因为看起来像是MD5加密的格式,但是数了一下发现有33个字符,就推测???熊孩子多敲了一位进去.从32个变33个了,然后 ...
- php 冒泡 快速 选择 插入算法 四种基本算法
php四种基础算法:冒泡,选择,插入和快速排序法 来源:PHP100中文网 | 时间:2013-10-29 15:24:57 | 阅读数:120854 [导读] 许多人都说 算法是程序的核心,一个程序 ...
- 虚拟树Demos\Minimal 简单的例子
//分析虚拟树demo6-VirtualTreeView\VirtualTreeViewV5.3.0\Demos\Minimal的main.pas文件 unit Main; // Demonstrat ...
- Trie URAL 7192 Chip Factory (15长春J)
题目传送门 题意:从n个数中选出不同的三个数a b c,使得(a+b)^c 最大 分析:先将所有数字按位插入到字典树上,然后删除两个数字,贪心询问与剩下的数字最大异或值. /************* ...
- 立flag
lixintong这半年来一直浪啊浪啊都不认真做题!!!!!!简直是太堕落啦!!lixintong非常讨厌这样的lixintong !!! 鉴于lixintong NOIP 完全爆炸啦! lixint ...
- Ubuntu 14.04 安装pdf阅读器
1. 个人推荐 okular. 关于安装okular的原因,可以很好的做到护眼功能. Ubuntu 14.04 自带的阅读器,因为白色太刺眼,长时间使用对眼睛不好. 对于,长时间编程的朋友们习惯夜间模 ...
- Oracle数据库字符集试验
对于初学者我们可以理解字符集就是一种字符编码方式,试想人可以直接语言进行交流,使用文字进行记录,而计算机却不认得我们人类创立的文字,计算机只认得0和1这样的二进制代码.当我们要通过计算机记录文字信息的 ...