用于Matlab的OpenCV(C ++)以双精度保存矩阵 [英] Saving matrix in double precision from OpenCV (C++) for Matlab

查看:117
本文介绍了用于Matlab的OpenCV(C ++)以双精度保存矩阵的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将通过OpenCV创建的矩阵与Matlab中的矩阵进行比较.如果矩阵是uint8,则将它们另存为pgm图像即可解决问题.但是我的矩阵是CV_64FC1(双精度),不能另存为图像.有什么简单的方法可以保存我的双矩阵以在Matlab中读取?

I want to compare matrices created from OpenCV with the ones in Matlab. If the matrices are uint8, Saving them as pgm images would do the trick. But my matrices are CV_64FC1 (double) that can't be saved as images. Is there any easy way to save my double matrix for reading in Matlab?

推荐答案

从OpenCV示例中尝试一下.

Try this one from OpenCV samples.

Mat r
std::stringstream ss;
ss << format(r,"csv") << endl << endl;
myFile << ss.str();
// or even this
myFile << format(r,"csv") << endl << endl;

这篇关于用于Matlab的OpenCV(C ++)以双精度保存矩阵的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆