Ask Your Question

Revision history [back]

Basically, the looping is the only thing that can be applied to access each element seperately and perform a function to it. This is because the Mat element is actually a pointer that is shifted through your memory.

So use the following iterator

general : matrix.at<elementType>(i,j);
example : test.at<double>(4,3);

However if you would like to perform some mathematical functions to the elements like elementwise multiplying, that is possible using the mul() operator.