dip::CovarianceMatrix class

A 2D covariance matrix for computation with 2D vertices.

The matrix is real, symmetric, positive semidefinite. See dip::Polygon::CovarianceMatrix for how to create a covariance matrix.

The elements stored are xx, xy and yy, with xx the top-left element, and xy both the off-diagonal elements, which are equal by definition.

Constructors, destructors, assignment and conversion operators

CovarianceMatrix() defaulted
Default-initialized covariance matrix is all zeros.
CovarianceMatrix(dip::VertexFloat v) explicit
Construct a covariance matrix as the outer product of a vector and itself.


struct Eigenvalues
Container for matrix eigenvalues.
struct EllipseParameters
Container for ellipse parameters.


auto xx() const -> dip::dfloat
Read matrix element.
auto xy() const -> dip::dfloat
Read matrix element.
auto yy() const -> dip::dfloat
Read matrix element.
auto Det() const -> dip::dfloat
Compute determinant of matrix.
auto Inv() const -> dip::CovarianceMatrix
Compute inverse of matrix.
auto Project(dip::VertexFloat const& v) const -> dip::dfloat
Computes v’ * C * v, with v’ the transpose of v. This is a positive scalar if v is non-zero, because C (this matrix) is positive semidefinite.
auto Eig() const -> dip::CovarianceMatrix::Eigenvalues
Compute eigenvalues of matrix.
auto Ellipse() const -> dip::CovarianceMatrix::EllipseParameters
Compute parameters of ellipse with same covariance matrix.


auto operator+=(dip::CovarianceMatrix const& other) -> dip::CovarianceMatrix&
Add other matrix to this matrix.
auto operator*=(dip::dfloat d) -> dip::CovarianceMatrix&
Scale matrix.
auto operator/=(dip::dfloat d) -> dip::CovarianceMatrix&
Scale matrix.

Class documentation

struct EllipseParameters

Container for ellipse parameters.

dip::dfloat majorAxis Major axis length
dip::dfloat minorAxis Minor axis length
dip::dfloat orientation Orientation of major axis
dip::dfloat eccentricity Ellipse eccentricity