/Ellipsoid-Fit

Approximate a cloud of points (3D/2D) with the inner and outer ellipsoid. Also known as the inner and outer Löwner-John ellipses.

Primary LanguagePythonMIT LicenseMIT

Elipsoid-Fit

Approximate a cloud of points (3D/2D) with the maximum volume inner and minimum volume outer ellipsoid. Also known as the inner and outer Löwner-John ellipses.

image

Installation

Using CVXPY package. Install the required packages into a separate virtual environment. I advise using Anaconda envinromment instead of pip, since CVXPY has all the necessary solvers compiled already there. Scikit image is needed to visualize your points.

Usage

I defined a set of random 3D points as a numpy array as input data. Alternatively, a 2D numpy array can be given.

  • inner_ellipsoid.py generates the maximum volume inscribed ellipsoid approximating a set of points
  • outer_ellipsoid.py generates the minimum volume enclosing ellipsoid around a set of points

Results on some random data:

Original points in blue, Outer Ellipsoid in Green Wireframe and Inner Ellipsoid as Orange Points

image

Solution in max_inner_ellipsoid_v2.py was inspired by Hongkai-Dai