카테고리 없음
Covariance matrix in Matlab vs OpenCV
newpolaris
2011. 2. 18. 11:52
From matlab document:
cov(x) or cov(x,y) normalizes by N-1, if N>1, where N is the number of observations. This makes cov(X) the best unbiased estimate of the covariance matrix if the observations are from a normal distribution. For N=1, cov normalizes by N.
::cvCalcCovarMatrix( (const CvArr**) &src, 1, opencvcov, NULL, CV_COVAR_ROWS | CV_COVAR_NORMAL );
matlabcov = cov(x);
note: size(x) == [7,100]
7 observations and 100 dimentional features then,
opencvcov : 1st row - 14910766 –6950127
matlabcov : 1st row - 2130110 –992875 31775.63 128139.6 234368.9 -79741.8 …
opencvcov / matlabcov = 6.999998
in floatpoint numbers