在“Mat”中加入矩阵元素,对象(不是CvMat对象)在OpenCV C ++ [英] Accesing a matrix element in the "Mat" object (not the CvMat object) in OpenCV C++

查看:205
本文介绍了在“Mat”中加入矩阵元素,对象(不是CvMat对象)在OpenCV C ++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人有任何想法如何访问元素的row,col在OpenCV 2.0的新的Mat类?文档链接如下,但我没有能够对它有任何意义。
http://opencv.willowgarage.com/documentation/cpp/basic%5Fstructures。 html#mat

Does anyone have any idea how to access elements by row, col in OpenCV 2.0's new "Mat" class? The documentation is linked below, but I have not been able to make any sense of it. http://opencv.willowgarage.com/documentation/cpp/basic%5Fstructures.html#mat

推荐答案

关于文档:

http://docs.opencv.org/2.4/modules/ core / doc / basic_structures.html#mat

它说:


(...)如果你知道矩阵元素
类型,例如它是float,那么你可以在<>()方法中使用

(...) if you know the matrix element type, e.g. it is float, then you can use at<>() method

也就是说, p>

That is, you can use:

Mat M(100, 100, CV_64F);
cout << M.at<double>(0,0);

也许更容易使用 Mat _ 类。它是 Mat 的模板包装器。
Mat _ 具有运算符()重载以访问元素。

Maybe it is easier to use the Mat_ class. It is a template wrapper for Mat. Mat_ has the operator() overloaded in order to access the elements.

这篇关于在“Mat”中加入矩阵元素,对象(不是CvMat对象)在OpenCV C ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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