﻿CvInvoke.cvCalcCovarMatrix Method
http://www.emgu.com
Calculates the covariation matrix and, optionally, mean vector of the set of input vectors.

Namespace: Emgu.CV
Assembly: Emgu.CV (in Emgu.CV.dll) Version: 2.4.10.1935 (2.4.10.1935)

# Syntax

C#
```public static void cvCalcCovarMatrix(
IntPtr[] vects,
int count,
IntPtr covMat,
IntPtr avg,
COVAR_METHOD flags
)```
Visual Basic
```Public Shared Sub cvCalcCovarMatrix (
vects As IntPtr(),
count As Integer,
covMat As IntPtr,
avg As IntPtr,
flags As COVAR_METHOD
)```
Visual C++
```public:
static void cvCalcCovarMatrix(
array<IntPtr>^ vects,
int count,
IntPtr covMat,
IntPtr avg,
COVAR_METHOD flags
)```
F#
```static member cvCalcCovarMatrix :
vects : IntPtr[] *
count : int *
covMat : IntPtr *
avg : IntPtr *
flags : COVAR_METHOD -> unit
```

#### Parameters

vects
Type: array<System..::..IntPtr>[]()[][]
The input vectors. They all must have the same type and the same size. The vectors do not have to be 1D, they can be 2D (e.g. images) etc
count
Type: System..::..Int32
The number of input vectors
covMat
Type: System..::..IntPtr
The output covariation matrix that should be floating-point and square
avg
Type: System..::..IntPtr
The input or output (depending on the flags) array - the mean (average) vector of the input vectors.
flags
Type: Emgu.CV.CvEnum..::..COVAR_METHOD
The operation flags

# Remarks

The function can be used for PCA, for comparing vectors using Mahalanobis distance etc.