为什么openCV Mat.at与原始矩阵不匹配 [英] why openCV Mat.at doesn't match original matrix

查看:136
本文介绍了为什么openCV Mat.at与原始矩阵不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个二维双精度型矩阵.

I have a two dimension double type matrix.

双**结果; (8334 * 34尺寸)

double ** results; (8334*34 size)

这些值类似于: 0.00211094,0,6.10098e-006 .......

The values are something like: 0.00211094, 0, 6.10098e-006.......

我使用代码Mat m = Mat(ROW,COL,CV_64F,results),

I use the code Mat m = Mat(ROW, COL, CV_64F, results),

但是当我检查元素时,我发现值不匹配,并且m中的值非常奇怪,类似于5.325e-344(太小了!)

but when I check the element, I found the values are not match, and the value in m in very strange, something like 5.325e-344 (too small!)

cout<(0,0)!=结果[0] [0]

cout<(0,0) != result[0][0]

我测试了一个小的矩阵,答案与矩阵匹配.

I test a small matrix, and the answer match the matrix.

double a = 0.00211094;
double b = 6.10098e-006;
double c=0;
double aa[3][3] = {{a, b, c}, {0.4, 0.5, 0.6}, {0.7, 0.8, 0.9}};
Mat m = Mat(3, 3, CV_64F, aa);

cout<<m.at<double>(0,1)<<endl;

谁能告诉我为什么?这是我的C ++内存问题(结果矩阵太大吗?)?

Could anyone tell me why? Is this my C++ memory's problem (results matrix is too large?)?

推荐答案

只能在Mat中设置小矩阵.

only small matrix could be set into Mat.

所以我尝试将每个元素设置为mat.

So I try to set each element into mat.

for(i...){
for(j...){
    m.at<double>(i,j) =results[i][j];
}
}

它有效.

有趣!

这篇关于为什么openCV Mat.at与原始矩阵不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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