Opencv:无法使用OpenCV从文本文件中正确读/写? [英] Opencv: Unable to correctly read/write from/to using OpenCV from a text file?
本文介绍了Opencv:无法使用OpenCV从文本文件中正确读/写?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
系统信息:windows 7,32 bit,opencv 2.4.10,msvs 2010
我有一个文本文件有一些整数值。
我想在Mat对象m中读取这些值,然后在控制台上打印出来。
到目前为止,我尝试的是:
)
{
Mat m;
/// read:
FileStorage fs(myfile.txt,FileStorage :: READ);
if(!fs.isOpened()){std :: cout< 无法打开文件存储! << std :: endl; return 0;}
fs [mat1]>> m;
cout<< mat1 =<< endl<< < m < endl<< endl;
return 0;
}
但这会打印;
mat1 = []
文件中的实际数据是: / p>
123456
123456
$ b b
请帮助我理解这里有什么错误。
更新
我甚至尝试mytext.xml,只需重命名.text文件。但我仍然看到空矩阵如上所示。
因此,文件不打开,因为输出是:
打开文件存储!