Ask Your Question

Access EM means using Python?

asked 2013-09-10 14:41:47 -0500

devmax gravatar image

trying to access the means after applying EM on a GMM: using code detailed here:

but I get this error: AttributeError: 'cv2.EM' object has no attribute 'getMeans'

I am using opencv 2.4.5 ( which only lists Algorithm::get() and Algorithm::set() functions for C++

How do I access the means and covariances using Python ?!

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-09-13 09:00:25 -0500

Guanta gravatar image

There is an example under <your-opencv-folder>/opencv/samples/python2/ , it shows that you can access the mean and cov-matrices via getMat('means') and getMatVector('covs'), e.g.:

em = cv2.EM(...) // specify params inside
em.train(...) // train your em
// get mean and covariance matrices
means = em.getMat('means') 
covs = em.getMatVector('covs')
edit flag offensive delete link more

Question Tools


Asked: 2013-09-10 14:41:47 -0500

Seen: 378 times

Last updated: Sep 13 '13