I have some MATLAB code that I want to migrate to OpenCV. The data that the MATLAB code uses is stored in a .mat file which is then loaded at run time.
I converted
Besides using XML/YAML file storages suggested by @Drodbar, you can also try cvmatio, which provides APIs to directly load MATLAB MAT files to OpenCV.
The code will be simply like:
#include "MatlabIO.hpp"
#include "MatlabIOContainer.hpp"
...
// load the MATLAB MAT file
MatlabIO matio;
bool ok = matio.open("-path-to-mat-file.mat", "r");
if (!ok) return -1;
// read all of the variables in the file
std::vector variables;
variables = matio.read();
matio.close();
// load the matrix by name in OpenCV style
cv::Mat basis = matio.find(variables, "B")