Fitting ellipsoid to 3D point cloud

Tweet


Ellipsoid

Ellipsoid is represented as follows.

Ax 2 + By 2 + Cz 2 + Dxy + Eyz + Fzx + Gx + Hy + Iz + J = 0 Ax^2+By^2+Cz^2+Dxy+Eyz+Fzx+Gx+Hy+Iz+J=0

Ten parameters are A, B, ..., J. Ellipsoid is a sphere with scaling (degree of freedom: 3), rotation (degree of freedom: 3), and translation (degree of freedom: 3). Multiplying same constant value to left hand side and right hand side results in same equation. The degree of freedom is 9. The above equation represents a quadric surface.


Least square method

In order to solve A,...,J using least squares method from point clouds, SVD is useful. The right singular vector assigned to the smallest singular value is the solution. Multiplying same constant value to left hand side and right hand side also results in the solution.


Centroid

3D coordinates of the barycenter (x0, y0, z0) of the ellipsoid can be calculated from following equation.

( 2 A D F D 2 B E F E 2 C ) ( x 0 y 0 z 0 ) = ( G H I ) left ( matrix{2A # D # F ## D # 2B # E ## F # E # 2C } right ) left ( matrix{x_0 ## y_0 ## z_0 } right ) =left ( matrix{-G ## -H ## -I } right )

I skip the derivation. The ellipsoid is an implicit function, so consider the local minima/maxima, and you can derive.


Semi-major axis and semi-minor axis

Ellipsoid has three axes. Those can be calculated as the eigenvectors of the following matrix.

( 2 A D F D 2 B E F E 2 C ) left ( matrix{2A # D # F ## E # 2B # E ## F # E # 2C } right )

I skip the derivation. The ellipsoid is an implicit function, and the Hessian is the above. The direction where the gradient of the 3D scalar field is the largest, smallest, and the moderate will be these three directions.


Semi-major radius and semi-minor radius

Radius can be calculated using the intersection between ellipsoid and line. Radius can also be represented by eigenvalue calculated from the above Hessian, but I skip to explain it.


Ellipse

How about ellipse in 3D space? If one of the radius of ellipsoid is infinite, that is the ellipse (or, elliptic cylinder).


Back