Skip to content

Instantly share code, notes, and snippets.

@denkiwakame
Last active August 29, 2015 14:01
Show Gist options
  • Save denkiwakame/88dcb6838b95225c8854 to your computer and use it in GitHub Desktop.
Save denkiwakame/88dcb6838b95225c8854 to your computer and use it in GitHub Desktop.
OpenCV x XML
// filio::output
system("mkdir data");
cv::FileStorage cvfs("./data/camera.xml", CV_STORAGE_WRITE);
cv::write(cvfs,"intrinsicMat", intrinsic_param_matrix);
cv::write(cvfs,"distCoeffs", distortion_coeffs);
// fileio::input
cv::FileStorage cvfs("./data/camera.xml", CV_STORAGE_READ);
cv::FileNode node(cvfs.fs, NULL);
cv::Mat in_mat, dist_coeff;
cv::read(node["intrinsicMat"], in_mat);
cv::read(node["distCoeffs"], dist_coeff);
std::cerr << ma << std::endl;
std::cerr << mb << std::endl;
cv::Mat ma, mb;
cvfs["intrinsicMat"] >> ma;
cvfs["distCoeffs"] >> mb; // OK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment