OpenCV Data Storage

Write OpenCV Data

  1. FileStorage fs("test.yml", FileStorage::WRITE);
  2. Mat m1= Mat::eye(2,3, CV_32F);
  3. fs << "m1" << m1;
  4. fs.release();

Read OpenCV Data

  1. FileStorage fs2("test.yml", FileStorage::READ);
  2. Mat r;
  3. fs2["m1"] >> r;
  4. std::cout << r << std::endl;
  5. fs2.release();

Leave a Reply

Your email address will not be published. Required fields are marked *