Beispiel #1
0
void ReadIntText(ifstream &is, int &n, bool hasName /*= true*/)
{
	if (hasName)
	{
		CString tmp;
		ReadStringLine(is, tmp);
	}
	is>>n;
	char c;
	is.get(c);
}
Beispiel #2
0
void ReadCvMatBin(ifstream &is, CvMat *mat, bool hasName /*= true*/)
{
	if (hasName)
	{
		CString tmp;
		ReadStringLine(is, tmp);
	}
	is.read((char*)mat->data.ptr, mat->step * mat->rows);
	char c;
	is.get(c);
}
bool ReadDataFromFile( ifstream &is )
{
	ReleaseSubspace();

	ReadIntText(is, g_blkCnt);
	CString tmp;
	ReadStringLine(is,tmp);
	ReadIntText(is, g_totalInputDim);
	g_totalPrjDim = g_totalInputDim;
	g_blkInputDim = g_totalInputDim / g_blkCnt;


	double weight[40]= {    
		0.5552,    0.4512,    0.4844,    0.3919,
		0.5412,    0.6145,    0.6537,    0.5232,
		0.4742,    0.6213,    0.6209,    0.4789,
		0.3825,    0.5416,    0.5881,    0.4213,
		0.2759,    0.4358,    0.4695,    0.3126,
		0.2213,    0.3923,    0.4098,    0.2576,
		0.2299,    0.3484,    0.3710,    0.2384,
		0.2286,    0.3066,    0.3228,    0.2226,
		0.2200,    0.2635,    0.3002,    0.2009,
		0.1753,    0.2648,    0.2704,    0.1633};

	PARAM g_bNoWeights = true;
	g_blkWeights = new double[g_blkCnt];
	if (g_bNoWeights)
	{
		for (int i=0; i<g_blkCnt;i++) 
			g_blkWeights[i] = 1;
		g_tm = cvCreateMat(g_totalInputDim, 1, CV_FT_FC1);
	}
	else
	{
		for (int i=0; i<g_blkCnt;i++)
			g_blkWeights[i] = weight[i];
		g_tm = cvCreateMat(g_blkInputDim, 1, CV_FT_FC1);
	}

	return true;
}