Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

A mat object is 2 D or 3 D array , if we consider that your mat object is 2 D so it is obligatory an array with dimension 2 , you can access to each element in your object mat "im" using for example :

for (int i = 1; i < im.rows-1; i++)
{
    for (int j = 1; j < im.cols-1; j++)
    {
        uchar p1 = im.at<uchar>(i, j);// you can access to each element (row/col) 

    }
}

A mat object is 2 D or 3 D array , if we consider that your mat object is 2 D so it is obligatory an array with dimension 2 , you can access to each element in your object mat "im" using for example :

for (int i = 1; 0; i < im.rows-1; im.rows; i++)
{
    for (int j = 1; 0; j < im.cols-1; im.cols; j++)
    {
        uchar p1 = im.at<uchar>(i, j);// you can access to each element (row/col) 

    }
}