opencv multi channel element access

Viewed 77203

I'm trying to learn how to use OpenCV's new C++ interface.

How do I access elements of a multi channel matrix? For example:

Mat myMat(size(3, 3), CV_32FC2);

for (int i = 0; i < 3; ++i)
{
    for (int j = 0; j < 3; ++j)
    {
        //myMat_at_(i,j) = (i,j);
    }
}

What is the easiest way to do this? Something like cvSet2D of the old interface.
What is the most efficient way? Similar to using direct pointers in the old interface.

5 Answers
Related