Accessing a matrix element in the “Mat” object (not the CvMat object) in OpenCV C++

On the documentation:

It says:

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

That is, you can use:

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

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.

Leave a Comment