Getting error while saving through Filestorage using opencv

asked 2013-10-01 13:55:54 -0500

FLY gravatar image

I am trying to save the vocabulary from the BOW algorithm , below is my code

FileStorage fs; 
fs.open("Vocabulary.xml", FileStorage::WRITE); 
Mat vocabulary = bow.cluster(); 
fs << vocabulary ;
fs.release();
FileStorage fs2; 
fs2.open("Vocabulary.xml", FileStorage::READ); 
fs2 ["Vocabulary"] >> vocabulary ;
dextract.setVocabulary(vocabulary);

cv::Mat training_mat(num_img , dictionarySize,CV_32FC1);
cv::Mat labels(num_img,1,CV_32FC1);

CvSVM svm;
svm.load( "trainsvm.xml" );

Here is my error :

OpenCV Error: Unspecified error (No element name has been given) in unknown function , file c:\opencv\2.4.4\build\include\opencv2\core\operations.hpp , line 2908
edit retag flag offensive close merge delete

Comments

1

hey fly, it's a key - value store here.

fs << "Vocabulary" << vocabulary ;

fs2 ["Vocabulary"] >> vocabulary ;

berak gravatar imageberak ( 2013-10-01 14:42:00 -0500 )edit

@berak hello berak , finally i am accepting your answer on first attempt :) , it works

FLY gravatar imageFLY ( 2013-10-01 15:03:23 -0500 )edit