I am trying to find the eigenvalues and eigenvectors a matrix as shown below:
int m = 5;
float b[5][5] = {
{ 1.96 , -6.49, -0.47, -7.20, -0.65},
{ -6.49, 3.80, -6.39, 1.50, -6.34},
{ -0.47, -6.39, 4.17, -1.51, 2.67},
{ -7.20, 1.50, -1.51, 5.70, 1.80},
{ -0.65, -6.34, 2.67, 1.80, -7.10}
};
cv::Mat E, V;
cv::Mat M(m,m,CV_64FC1,b);
cv::eigen(M,E,V);
// eigenvalues sorted desc
for(int i=0; i < 5; i++)
std::cout << E.at<float>(0,i) << " \t";
That works for me:
The problem is that "CV_64FC1" is double not float (check CV-types here).