Ask Your Question

Revision history [back]

I think it's very simple. You can access pixel (i,j) in the following way:

Mat ExampleMat(n,n,CV_32F1);
//assume you want to access the pixel at location row = i, column = j
float * rowP = ExampleMat.ptr<float>(i);
float pixelValue = rowP[j];

It's faster than the regular way:

float pixelValue = ExampleMat.at<float>(i,j);

In the code you provided, they go over the rows in the outer loop and over the columns in the inner loop.

Please let me know if you have any further question or if something is not clear.

Gil.