Reputation: 5432
I want to use cv::fileStorage
to save the calibration result as an XML
file like :
cv::FileStorage fs = cv::FileStorage("calibration_result.xml",cv::FileStorage::FORMAT_XML||cv::FileStorage::WRITE);
this doesn't work but when I choose the yml
extension it works ? any idea why is that happening ?
thanks in advance !
Upvotes: 0
Views: 304
Reputation: 10850
Try the code below. It should work.
...
FileStorage fs("calibration_result.xml", FileStorage::WRITE);
Mat R = Mat_<uchar >::eye (3, 3),
T = Mat_<double>::zeros(3, 1);
fs << "R" << R; // Write cv::Mat
fs << "T" << T;
fs.release();
...
I've tested it and it writes file with content:
<?xml version="1.0"?>
<opencv_storage>
<R type_id="opencv-matrix">
<rows>3</rows>
<cols>3</cols>
<dt>u</dt>
<data>
1 0 0 0 1 0 0 0 1</data></R>
<T type_id="opencv-matrix">
<rows>3</rows>
<cols>1</cols>
<dt>d</dt>
<data>
0. 0. 0.</data></T>
</opencv_storage>
Upvotes: 1