I want to do processing on images with C++ and have been using OpenCV. I've gotten a bit stuck though when it comes to trying to access each pixel individually. I can output the whole gray scaled image just fine using:
cout << image;
and get the expected output of values like so:
[143, 147, 164, 177, 177, 185, 196, 195, 185, 186, 178, 190, 178, 163, 183...
But when I try to output one pixel at a time using:
for (int y = 0; y < image.rows; ++y) {
for (int x = 0;x < image.cols; ++x) {
std::cout<<image.at<double>(y, x)<<" ";
}
cout << endl;}
my output is a bunch of large numbers like these:
-2.98684e+18 -1.21685e-83 -1.91543e-113 -1.8525e-59 -2.73052e-127 -2.08731e-35 -3.72066e-103 ...
Any thoughts as to what I am missing or doing wrong?