Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Calculate Eigen Vector and Eigen Value for PCA

I want to get eigenvalue and eigenvector. But it breaks. this is my part of code.

Mat covmat=((matdev*matdev.t())/3); //data float matrix 5*5, this's working. but when I add with PCA function. It's break.
PCA pt_pca(covmat, Mat(), CV_PCA_DATA_AS_ROW, 0);
            Mat pt_eig_vals = pt_pca.eigenvalues;
            for (int i = 0; i < 4; ++i)
            cout <<<float>(i, 0) <<endl;

This is the error. OpenCV error: Assertion Failed <data.channerls&lt;&gt; =="1"> in unknown function, file ......\src\opencv\modules\core\src\matmul.cpp

Please somebody help me :(. Thanks