Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

ah, thanks a lot for reporting back. it was missing a second tweak (a CV_OUT before vector<mat>) so it actually returns the covs array. (you do not have to pre-allocate or feed it in).

i'll update the patch in a second.

(really, thanks again, you saved me from making a fool of myself there ;)

ah, thanks a lot for reporting back. it was missing a second tweak (a CV_OUT before vector<mat>) so it actually returns the covs array. (you do not have to pre-allocate or feed it in).

i'll update the patch in a second.second, please try again !

(really, thanks again, you saved me from making a fool of myself there ;)

ah, thanks a lot for reporting back. it was missing a second tweak (a CV_OUT before vector<mat>) so it actually returns the covs array. (you do not have to pre-allocate or feed it in).

i'll update the patch in a second, please try again !

(really, thanks again, you saved me from making a fool of myself there ;)

ah, thanks a lot for reporting back. it was missing a second tweak (a CV_OUT before vector<mat>) so it actually returns the covs array. (you do not have to pre-allocate or feed it in).

i'll update the patch in a second, is updated, please try again !

from cv2 import ml
import numpy as np

data = np.ones((10,10), np.float32)

em = ml.EM_create()
em.setClustersNumber(5)
em.trainEM(data)
covs = em.getCovs()
print(covs)

ah, thanks a lot for reporting back. it was missing a second tweak (a CV_OUT before vector<mat>) so it actually returns the covs array. (you do not have to pre-allocate or feed it in).

patch is updated, please try again !

from cv2 import ml
import numpy as np

data = np.ones((10,10), np.float32)

em = ml.EM_create()
em.setClustersNumber(5)
em.trainEM(data)
covs = em.getCovs()
print(covs)

[array([[  2.22044605e-16,   0.00000000e+00,   0.00000000e+00,
          0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
          0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
          0.00000000e+00],
       ....

(5 arrays a 10x10)

ah, thanks a lot for reporting back. it was indeed missing a second tweak (a CV_OUT before vector<mat>) so it actually returns the covs array. (you do not have to pre-allocate or feed it in).

patch is updated, please try again !

from cv2 import ml
import numpy as np

data = np.ones((10,10), np.float32)

em = ml.EM_create()
em.setClustersNumber(5)
em.trainEM(data)
covs = em.getCovs()
print(covs)

[array([[  2.22044605e-16,   0.00000000e+00,   0.00000000e+00,
          0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
          0.00000000e+00,   0.00000000e+00,   0.00000000e+00,
          0.00000000e+00],
       ....

(5 arrays a 10x10)