来自一组点的C ++平面插值 [英] C++ plane interpolation from a set of points

查看:143
本文介绍了来自一组点的C ++平面插值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用PCL,点云,库用C ++进行编程.

I am programming in C++ with the PCL, point cloud, library.

我的问题是:计算某些点的方差,但仅相对于相对于平面的垂直轴进行方差计算.我会自我解释:

My problem is: computing the variance of some of the points but only with respect to the perpendicular axis with respect to the plane. I will explain myself:

所以我正在做的是将点云按表面平滑度划分为多个部分(区域增长细分).对于每个线段,我都希望测量表面的精确度,而我认为最好的方法是计算最适合表面中的点的平面,然后从根本上计算出点相对于平面的方差(从点到平面的距离等). 因此,我知道3D中存在二次或样条插值,但是我不太擅长,因此我认为应该有一个aldready执行它的库.但是,我发现的大多数对象都不计算/不返回平面方程,因此我不确定该怎么做.

So what I am doing is dividing the point cloud into segments by surface smoothness (with region growing segmentation). For each segment I would like to have a measurement of how accurate the surface is, and I thougth the best way was to compute the plane that best fits the points in the surface and then basically compute the variance of the points with respect to the plane (distance from the point to the plane, etc). So I know there exists the quadratic or spline interpolation in 3D, but I am not so good at it and I thougth there should be a library that aldready performs it. However most of the ones I found do not compute/return the plane equation, so I am not so sure how to do it.

我们非常感谢您的帮助,

Any help is appreciated, cheers.

推荐答案

为此您需要基向量...因此,让N为您的平面法线.要对飞机进行插值,您需要在飞机内部有2个基矢量U,V和属于该飞机的一个起点P0 ...

you need basis vectors for this ... so let N be your plane normal. To interpolate your plane you need 2 basis vectors U,V inside your plane and one start point P0 belonging to that plane...

让我们假设我们知道N,P0,因此U,V可以通过利用叉积来计算:

Lets assume we know N,P0 so the U,V can be computed by exploiting cross product:

// U is any vector non parallel to N
U = (1.0,0.0,0.0)
if (|dot(U,N)|>0.75) U = (0.0,1.0,0.0)
// make U,V perpendicular to N and each other
V = cross(N,U)
U = cross(V,N)
// normalize U,V,N
U = U/|U|
V = V/|V|
N = N/|N|

现在可以像这样对平面上的任何点进行插值:

Now any point on plane can be interpolated like this:

P(u,v) = P0 + u*U + v*V

其中u,v是您的插值标量参数,也等于P(u,v)UV方向上与P0的垂直距离.

Where u,v are your interpolation scalar parameters which are also equal to perpendicular distance of P(u,v) in U and V directions from P0.

要评估您的点到飞机(高度)的距离,只需执行此操作

To evaluate the distance of your point from the plane (altitude) you can simply do this

alt = dot(N,P(u,v)-P0)

因此不需要二次方程...同样,如果您需要u,v某个点P,则可以执行以下操作:

so no quadratics is needed ... Similarly if you need the u,v for some point P you can do this:

u = dot(U,P-P0)
v = dot(V,P-P0)

这篇关于来自一组点的C ++平面插值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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