Exemple #1
0
void Classifier::SaveClassifierToFile(string fileName)
{
	if (em_model.isTrained() == false)
		return;

	FileStorage fs = FileStorage(fileName, FileStorage::WRITE);
	em_model.write(fs);

	fs.release();
}
Exemple #2
0
int train(float* src,char *filename,int N)
{
    EM* myGMM = new EM(5);
	FileStorage tmp(filename,cv::FileStorage::WRITE);
    Mat train_32F(N,3,CV_32FC1,src);
    train_32F.convertTo(train_32F,CV_32F,1/255.);
    myGMM->train(train_32F);
    tmp<<"model";
	myGMM->write(tmp);
	tmp.release();
	
    return 0;
}