寫教學的最大目的是教會未來的自己

openCV Mat的儲存與讀取

之前已經寫過兩篇 關於openCV 資料的儲存與讀取,今天又找到一個方便的方法

儲存架構同樣式XML

 

參考資料  http://blog.csdn.net/mmjwung/article/details/6913540

 

寫入

Mat mat = Mat::eye(Size(12,12), CV_8UC1);  //這沒差

 FileStorage fs(".\\vocabulary.xml", FileStorage::WRITE);  //檔案名稱用 XML

 fs<<"vocabulary"<<mat;  

 fs.release();  

 

讀取

FileStorage fs(".\\vocabulary.xml", FileStorage::READ);  

 Mat mat_vocabulary;  

 fs["vocabulary"] >> mat_vocabulary;  

 

經過測試,一個檔案可以分別寫入多個MAT 然後讀取。

Post to Twitter Post to Plurk Post to Facebook Send Gmail

發表迴響

Copyright © 2024. All Rights Reserved.

歡迎光臨
初音