我需要使一个最佳圆适合Matlab中的3D数据 [英] I need to fit a best circle to the 3D data in matlab

查看:58
本文介绍了我需要使一个最佳圆适合Matlab中的3D数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上,我在地面上有x,y,z坐标(200 * 3矩阵)形式的许多不规则圆形.但我想为x,y,z坐标(200 * 3矩阵)的数据确定一个最佳圆.

Basically, I have a many irregular circle on the ground in the form of x,y,z coordinates (of 200*3 matrix). but I want to fix a best circle in to the data of x,y,z coordinates (of 200*3 matrix).

任何帮助将不胜感激.

推荐答案

尽管这个答案很晚,但希望对其他人有帮助

Though this answer is late, I hope this helps others

使圆适合3d点

  1. 找到3d点(nx3矩阵)的质心
  2. 从3D点中减去质心.
  3. 使用RANSAC,将平面拟合到3D点.您可以参考此处以使用RANSAC拟合平面的功能
  4. 将SVD应用于3d点(nx3矩阵)并获得v矩阵
  5. 使用SVD中的轴生成沿RANSAC平面的轴.例如,如果平面范数沿z方向,则v矩阵的第一列与平面范数之间的叉积将沿y方向生成矢量,然后将生成的y矢量与平面之间的叉积范数将沿x方向生成向量.使用生成的向量,形成旋转矩阵[x_vector y_vector z_vector]
  6. 将旋转矩阵"乘以质心减去3d点,以使这些点与XY平面平行.
  7. 只需从3d点中删除Z轴,即可将点投影到XY平面
  8. 使用最小二乘圆来拟合圆适合
  9. 使用从第5步获得的旋转矩阵的逆矩阵旋转圆心
  10. 使用质心将中心平移回原始位置
  1. Find the centroid of the 3d points (nx3 matrix)
  2. Subtract the centroid from the 3D points.
  3. Using RANSAC, fit a plane to the 3D points. You can refer here for the function to fit plane using RANSAC
  4. Apply SVD to the 3d points (nx3 matrix) and get the v matrix
  5. Generate the axes along the RANSAC plane using the axes from SVD. For example, if the plane norm is along the z-direction, then cross product between the 1st column of v matrix and the plane norm will generate the vector along the y-direction, then the cross product between the generated y-vector and plane norm will generate a vector along the x-direction. Using the generated vectors, form a Rotation matrix [x_vector y_vector z_vector]
  6. Multiply the Rotation matrix with the centroid subtracted 3d points so that the points will be parallel to the XY plane.
  7. Project the points to XY plane by simply removing the Z-axes from the 3d points
  8. fit a circle using Least squares circle fit
  9. Rotate the center of the circle using the inverse of the rotation matrix obtained from step 5
  10. Translate back the center to the original location using the centroid

3D中的圆将具有中心,半径将与从步骤8中获得的2D圆相同,圆平面将成为我们从步骤3中获得的RANSAC平面.

The circle in 3D will have the center, the radius will be the same as the 2D circle we obtained from step 8, the circle plane will be the RANSAC plane we obtained from step 3

这篇关于我需要使一个最佳圆适合Matlab中的3D数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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