1 | initial version |
You use the wrong datatype. The bitdepth of an image with pixels in the range from 0 to 255 is 8bit. So you have to "cast" to uchar.
cout<<setw(10)<<img.at<uchar>(i,j);
A good tutorial on how to access pixels in OpenCV can be found here.