How to use clustering file after training I trained the data using BOG with SVM , i trained it , now i just want to open it through xml , i don't want to train it again and again on every run ,
I trained the svm and now loading it using its loading function

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


But how to do the same with vocabulary file which i use for clustering using BOG algorithm , below is my code , which is training the data , but i want to open it now like svm

for (i = all_names.begin(); i != all_names.end(); ++i)
{
    Dir=( (count &lt; files.size() ) ? YourImagesDirectory : YourImagesDirectory_2);

    Mat row_img = cv::imread( Dir +*i, 0 );

    detector.detect( row_img, keypoints);

    RetainBestKeypoints(keypoints, 20);

    extractor-&gt;compute( row_img, keypoints, descriptors_1);

    descriptors_1.reshape(1,1);

    bow.add(descriptors_1);

    ++count;
}

vector&lt;string&gt;::const_iterator k;

cout&lt;&lt;"CLUSTERING"&lt;&lt;endl;
Mat vocabulary = bow.cluster();

dextract.setVocabulary(vocabulary);

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


This is clustering the data , now i don't want to run it again and again because it takes too much time , when it trained once , i just want to use it , so that i can speed up my program
You can use cv::FileStorage. You can follow this post here and this documentation here.