Matlab的边界函数使用什么算法? [英] What algorithm does Matlab's boundary function use?

查看:898
本文介绍了Matlab的边界函数使用什么算法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您可能已经注意到,在较新的matlab版本中, 边界函数(用于计算一组2d或3d点的边界)已得到改进.

As you may have already noticed, in the newer versions of matlab the boundary function (which computes the boundary for a set of 2d or 3d points) has been improved.

现在可以为函数指定一个称为收缩因子"的参数.如果收缩系数为0,则跟踪的边界是传统的凸包.当收缩参数越大,边界越收缩.如果您未指定任何值,则收缩系数的默认值为0.5.

Now it is possible to give the function a parameter called 'shrink factor'. If the shrink factor is 0, then the boundary traced is the traditional convex hull. The boundary is more shrinked when the shrink parameter is bigger. The default value for the shrink factor is 0.5, in case you don't specify any value.

因此,我了解它的用途以及它的作用(实际上,我已经在项目中使用过该功能),但是我不知道它是如何工作的.此收缩系数的几何原理是什么?

So, I understand its use and what it does (actually I've already used the function in a project), but I don't know how it works. What are the geometrical principles of this shrink factor?

谢谢!

推荐答案

在自己寻找答案的同时发现了您的问题.希望您现在已经解决了.我已经弄清楚了,以防万一有人发现这个问题,这是我对boundary()函数的理解.

Found your question while loooking for the answer myself. Hope you've solved it by now. I've figured it out and in case someone else finds this question, here's my understanding of the boundary() function.

边界函数是alpha形状的实现.使用alpha形状,可以通过使用一组特定半径的圆为一组点分配一个多边形: 想象围绕这些点绘制的任意形状,然后使用特定半径的圆尽可能多地移除该形状.继续尽可能长的时间,不要包含任何点.较小的半径将意味着可以删除更多的材质",较大的半径将意味着较少的删除",即较小的半径将创建近似的裁剪形状,而无限的半径将重新创建集合的凸包.然后将确定为边缘点的点与直边截去.这会在点集内创建空心区域. 参见例如 http://doc.cgal.org/latest/Alpha_shapes_2/index.html

The boundary function is an implementation of alpha shapes. Using alpha shapes, a set of points can be assigned a polygon by using a set of circles of a specific radius: imagine an arbitrary shape drawn around the points and proceed to remove as much of this shape as possible using circles of a specific radius. Continue as long as possible, without enclosing any points. A small radius will mean more "material" can be removed, a larger radius means less "removal", i.e. a small radius creates a close cropped shape whereas an infinite radius recreates a convex hull of the set. The points determined to be edge points are then conencted with straight edges. This can create hollow areas inside the point set. See e.g. http://doc.cgal.org/latest/Alpha_shapes_2/index.html

MATLAB具有alphashape()函数,该函数可计算具有所有可能的alpha半径给出不同形状的alphashape.在边界函数中使用.

MATLAB has an alphashape() function which calculates alphashapes with all possible alpha radii giving different shapes. This is used in the boundary function.

boundary()工作流程:

boundary() workflow:

(1)创建alphashape

(1) Create alphashape

(2)查找关键的alpha半径,需要为alpha形状创建单个区域

(2) Find critical alpha radius, needed to create a single region for alpha shape

(3)提取所有创建高于此临界值的唯一形状的alpha值

(3) Extract all alphavalues that create unique shapes above this critical value

(4)使用收缩系数S 选择要使用的单个alpha值.

(4) Use the shrink factor, S, to select a single alpha value to use.

示例:对于S = 0.25,使用索引为(1-.25)* numel(alphavalues> = alpha_crit)的alpha半径.这将创建一个Alpha形状 使用第75个最小的alpha半径产生单个区域 (对于S = 0.25).

Example: with S=0.25, use alpha radius with index (1-.25)*numel(alphavalues>=alpha_crit). This creates an alpha shape using the 75th smallest alpha radius giving rise to a single region (for S=0.25).

如果S = 1(最大收缩),则给出最低的alpha半径,从而给出单个 字母形状的区域.

If S=1 (max shrink), gives the lowest alpha-radius that gives a single region for the alpha-shape.

如果S = 0(无收缩),则给出最大的alpha半径,从而得到唯一的 形状. (增加alpha半径无效).

If S=0 (no shrink), gives the maximum alpha-radius that gives a unique shape. (Incraesing alpha radius further has no effect).

(5)将填充Alpha形状的孔的阈值设置为与Alpha Shape的面积相同,即填充所有孔.

(5) set the threshold for filling in holes in the alphashape to be the same as the alphashape's area, i.e. fill in all holes

(6)将原始点云的索引对应于此alphashape的顶点.

(6) Return the indices of the original point cloud correspocing to the vertices of this alphashape.

boundary.m文件的相关部分(第79-86行)

The relevant section of the boundary.m file (lines 79-86)

Acrit = shp.criticalAlpha('one-region'); %alpha-radius required for single region
spec = shp.alphaSpectrum();%all alphavalues
idx = find(spec==Acrit);
subspec = spec(1:idx);%alphavalues up to criticalAlpha
subspec = flipud(subspec);%reverse order
idx = max(ceil((1-S)*numel(subspec)),1); %find index from shrink factor
alphaval = subspec(idx); 
shp.Alpha = alphaval; %set alpha value of alpha shape
shp.HoleThreshold = areavol; % remove holes in interior

希望这很清楚,对某人有用.

Hope this is clear enough and useful to someone.

我使用MATLAB R2014b

I use MATLAB R2014b

这篇关于Matlab的边界函数使用什么算法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆