# Measurement module#include "diplib/chain_code.h" dip::CovarianceMatrix class

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

### Contents

• Reference

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

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

## Classes

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

## Functions

auto xx() const -> dip::dfloat
auto xy() const -> dip::dfloat
auto yy() const -> dip::dfloat
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.

## Operators

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

## Class documentation

### struct EllipseParameters

Container for ellipse parameters

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