System Information: Windows 7, 32 bit, opencv 2.4.10, msvs 2010
I have a text file with integer values. I want to read these values in a Mat m object and then print to the console.
What I have tried so far is the following:
int main()
{
Mat m;
FileStorage fs("myfile.txt",FileStorage::READ);
if (!fs.isOpened()) {std::cout << "unable to open file storage!" << std::endl; return 0;}
fs["mat1"] >> m;
cout << "mat1 = "<< endl << " " << m << endl << endl;
return 0;
}
However, it prints;
mat1 = []
actual data in the file:
123456
123456
So kindly help me understand what is wrong here.
Update
I even tried mytext.xml by simply renaming the .text file. But still I see the empty matrix as above.
So the file does not open because the output is:
unable to open file storage!
source
share