I am trying to loop over a matrix and print its element, which should be a simple operation, but I experience some strange things...
I have a a null matrix : cv::Mat accum = cv::Mat::zeros(3,5,CV_8U);
Doing this:
for(int i=0;i<accum.rows;i++)
{
for(int j=0;j<accum.cols;j++)
{
cout<<accum.at<int>(i,j) <<endl;
}
}
I get the following elements:
0 0 0 0 0 0 0 0 0 -536870912 0 0 0 2027945984 587217671
Why is there some random number at places where zero should be?
If I initialize the value of matrix at i=1,j=1 with number 1, I get the following
0 0 256 0 0 0 1 0 0 587202560 0 0 0 1931673600 587257437
I just dont understand those random values, I might do something wrong, but cant figure out what. Could you please help?