Is this the correct way of accessing all pixels in cv::Mat:
for( row = 0; row < mat.rows; ++row)
{
for ( col = 0; col < mat.cols; ++col)
{
}
}
Or is there a formula method similar to this formula for an IplImage *:
temp_ptr = &((uchar*)(img->imageData + (img->widthStep*pt.x)))[pt.y*3];
In the best case, where all the pixels are stored contiguously you should be able to do:
To be a bit more generic, but still fast, have a look at the sample code mentioned with
Mat::isContinuous(). The general formula for calculating the address of an element can be seen here (Reproduced below).