24,855
社区成员
发帖
与我相关
我的任务
分享
#include "stdafx.h"
#include <contrib\contrib.hpp>
#include <iostream>
using namespace cv;
using namespace std;
int main(void)
{
float sampledata[4][2]={{0.0,0.0},{0.0,1.0},{4.0,0.0},{4.0,6.0}};
Mat mat=Mat(4,2,CV_32FC1,sampledata);
vector<int>labels;
labels.resize(4);
labels[0]=0;
labels[1]=0;
labels[2]=1;
labels[3]=1;
LDA lda=LDA(mat,labels);
//Mat value=Mat(2,1,CV_32FC1);
Mat value=lda.eigenvalues();
for(int i=0;i<value.rows;i++)
{
for(int j=0;j<value.cols;j++)
{
cout<<value.at<int>(i,j)<<" ";
}
cout<<endl;
}
system("pause");
return 0;
}