Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You may need to use OpenCV XML/YAML file storages to store Mat in to file and later read back.

Writing Mat to file

Mat src = imread( "img.jpg",1);
FileStorage Data_W("Data.yml",FileStorage::WRITE); // Store the  data in a file
Data_W << "data" << src;
Data_W.release();

Reading back from file

Mat dst;
FileStorage Data_R("Data.yml",FileStorage::READ); // Read traing data to a Mat
Data_R["data"] >> dst;
Data_R.release();
imshow("dst",dst);
waitKey();