我试图找到特征值和特征向量矩阵,如下所示:
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";
答案 0 :(得分:0)
这对我有用:
int m = 5;
double 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);
cout << "M: " << M << endl;
cv::eigen(M,E,V);
cout << "E: " << E << endl;
cout << "V: " << V << endl;
问题在于&#34; CV_64FC1&#34;是双重不浮动(check CV-types here)。