Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 41027

opencv3 EM.getCovs(covs)

$
0
0
what type should `covs` be in `getCovs(covs)`? From the 3.0-beta c++, "Returns vector `std::vector& covs` of covariation matrices. Number of matrices is the number of gaussian mixtures, each matrix is a square floating-point matrix NxN, where N is the space dimensionality." from this old opencv2 [bug](http://code.opencv.org/issues/1117 "bug"), I understand that "vector corresponds to a list of numpy arrays, not 3D numpy array (since matrices in vector can in general have different size.) " from cv2 import ml import numpy as np def dictionary(descriptors, number_clusters=N): covs = [np.zeros(( N, N), np.float64)] em = ml.EM_create() em.setClustersNumber(N) em.trainEM(descriptors) means = em.getMeans() covs = em.getCovs(covs) weights = em.getWeights() return np.float32(means), np.float32(covs), np.float32(weights)[0] printing out `covs` just prints out the original `[np.zeros(( N, N), np.float64)]`. Any body know how to get the covs? *Note that attempting to run this code will not work without fixing this [bug](https://github.com/Itseez/opencv/pull/4232 "bug") and rebuilding.*

Viewing all articles
Browse latest Browse all 41027

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>