Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Calculate covariance in Opencv

Dears forum followers I have a issue which I don't know how solve it.

I have a Mat like:

500.0   350.2
500.5   355.8
498.7   352.0
............

And I need calculate the covariance. The result would be something like: 0.8633 1.2167 1.2167 8.1733

I hope another problem: If I have a set of clusters could I get the weight of these clusters like Expectation Maximization does it. How?: (http://docs.opencv.org/modules/ml/doc/expectation_maximization.html#ml-expectation-maximization)

I hope you can help my with my problem!! Thank you in advanced!

Calculate covariance in Opencv

Dears forum followers I have a issue which I don't know how solve it.

I have a Mat like:

500.0   350.2
500.5   355.8
498.7   352.0
............

And I need calculate the covariance. The result would be something like: like:

0.8633    1.2167
 1.2167    8.1733

8.1733

I hope another problem: If I have a set of clusters could I get the weight of these clusters like Expectation Maximization does it. How?: (http://docs.opencv.org/modules/ml/doc/expectation_maximization.html#ml-expectation-maximization)

I hope you can help my with my problem!! Thank you in advanced!

Calculate covariance in Opencv

Dears forum followers I have a issue which I don't know how solve it.

I have a Mat like:

500.0   350.2
500.5   355.8
498.7   352.0
............

And I need calculate the covariance. The result would be something like:

0.8633    1.2167
1.2167    8.1733

Of course, the function which I need is calcCovarMatrix.... BUT if I execute these code:

cv::Mat a = (cv::Mat_<double>(3, 2) << 500.0, 350.2, 500.5, 355.8, 498.7, 352.0);
cv::Mat mu, new_covs;
cv::calcCovarMatrix(a, new_covs, mu, CV_COVAR_NORMAL | CV_COVAR_COLS);
The result is a incomprehensible 3x3 matrix...
new_covs=
[11220.02, 10838.03, 10987.83;
  10838.03, 10469.045, 10613.745;
  10987.83, 10613.745, 10760.445]

I hope another problem: If I have a set of clusters could I get the weight of these clusters like Expectation Maximization does it. How?: (http://docs.opencv.org/modules/ml/doc/expectation_maximization.html#ml-expectation-maximization)

I hope you can help my with my problem!! Thank you in advanced!

click to hide/show revision 4
No.4 Revision

Calculate covariance in Opencv

Dears forum followers I have a issue which I don't know how solve it.

I have a Mat like:

500.0   350.2
500.5   355.8
498.7   352.0
............

And I need calculate the covariance. The result would be something like:

0.8633    1.2167
1.2167    8.1733

Of course, the function which I need is calcCovarMatrix.... BUT if I execute these code:

cv::Mat a = (cv::Mat_<double>(3, 2) << 500.0, 350.2, 500.5, 355.8, 498.7, 352.0);
cv::Mat mu, new_covs;
cv::calcCovarMatrix(a, new_covs, mu, CV_COVAR_NORMAL | CV_COVAR_COLS);
The result is a incomprehensible 3x3 matrix...
new_covs=
[11220.02, 10838.03, 10987.83;
  10838.03, 10469.045, 10613.745;
  10987.83, 10613.745, 10760.445]

I hope have another problem: problem:

If I have a set of clusters could I get the weight of these clusters like Expectation Maximization does it. How?: (http://docs.opencv.org/modules/ml/doc/expectation_maximization.html#ml-expectation-maximization)

I hope you can help my with my problem!! Thank you in advanced!

click to hide/show revision 5
No.5 Revision

Calculate covariance in Opencv

Dears Dear forum followers I have a issue which I don't know how solve it.

I have a Mat like:

500.0   350.2
500.5   355.8
498.7   352.0
............

And I need calculate the covariance. The result would be something like:

0.8633    1.2167
1.2167    8.1733

Of course, the function which I need is calcCovarMatrix.... BUT if I execute these code:

cv::Mat a = (cv::Mat_<double>(3, 2) << 500.0, 350.2, 500.5, 355.8, 498.7, 352.0);
cv::Mat mu, new_covs;
cv::calcCovarMatrix(a, new_covs, mu, CV_COVAR_NORMAL | CV_COVAR_COLS);
The result is a incomprehensible 3x3 matrix...
new_covs=
[11220.02, 10838.03, 10987.83;
  10838.03, 10469.045, 10613.745;
  10987.83, 10613.745, 10760.445]

I have another problem:Another question:

If I have a set of clusters could I get the weight of these clusters like Expectation Maximization does it. How?: (http://docs.opencv.org/modules/ml/doc/expectation_maximization.html#ml-expectation-maximization)

I hope you can help my with my problem!! Thank you in advanced!