Skip to content

Instantly share code, notes, and snippets.

@mpkuse
Created December 5, 2019 04:18
Show Gist options
  • Save mpkuse/de59f1ee691e562d1309126513e38822 to your computer and use it in GitHub Desktop.
Save mpkuse/de59f1ee691e562d1309126513e38822 to your computer and use it in GitHub Desktop.
OpenCV 3 Read Write FileStorage YAML Example
//
// OpenCV provides an easy class interface for read and write cv::Mat
// can also use these with Eigen by converting eigen mat to cv::Mat using
// cv::cv2eigen() and cv::eigen2cv()
// Writing to file
cv::FileStorage storage("test.yml", cv::FileStorage::WRITE);
storage << "img" << img;
storage.release();
// Reading from file
cv::FileStorage storage("test.yml", cv::FileStorage::READ);
storage["img"] >> img;
storage.release();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment