C++使用OpenCV保存和读取XML

代码

// save xml file
cv::FileStorage file(save_transform, cv::FileStorage::WRITE);
cv::Mat TransM = cv::Mat::ones(100,200,CV_8UC1);
file << "TransM" << TransM;


// read xml file
cv::FileStorage file("xml_file_path", cv::FileStorage::READ);

if (!file.isOpened())
	return std::vector<cv::Mat>();

cv::Mat TransM;
file["TransM"] >> TransM;

  

注意

xml中保存的节点超过4个就会打开失败,opencv的问题。 

 

posted @ 2018-09-09 17:01  路边的十元钱硬币  阅读(773)  评论(0编辑  收藏  举报