不过还是有问题,正在慢慢分析原因吧。

#include <cv.h>
#include <cxcore.h>
#include <highgui.h>
#include <fstream>
#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
	ifstream myfile( "E:\\feature_size.txt ");
	if (!myfile.is_open())
		cout << "Unable to open file";
	int rows = 0,cols = 20;
	myfile >> rows ;
	//ifstream feature_file( "E:\\features.txt ");
	CvMat *fc = cvCreateMat(rows,cols,CV_32FC1);
	CvMat *dst = cvCreateMat(rows,cols,CV_32FC1);
	ifstream fin("E:\\feature_pca.txt ",std::ifstream::in);
	for(int i = 0;i < rows; ++i)
		for(int j = 0;j < cols; ++j)
		{
			fin >> fc->data.fl[i*cols+j];
		}        
		fin.close();
    cvNormalize(fc,dst,1,0,CV_C,NULL);
	ofstream file( "E:\\feature_guiyihua.txt ");
	for (int i = 0; i < dst->rows;++i)
	{
		for(int j = 0;j < dst->cols; ++j)
		{
			file << cvmGet(dst,i,j) << " ";
		}
		file << "\n";
	}
}

  

相关文章:

  • 2021-07-18
  • 2022-12-23
  • 2021-12-01
  • 2021-12-08
  • 2021-05-23
  • 2022-01-17
  • 2021-12-20
  • 2021-11-13
猜你喜欢
  • 2022-12-23
  • 2021-06-20
  • 2021-08-02
  • 2022-12-23
  • 2021-10-25
  • 2021-06-22
  • 2022-12-23
相关资源
相似解决方案