1 | initial version |
MatConstIterator
(without any template brackets) defaults to MatConstIterator_<uchar>
so, that's the wrong type. try like:
Point2i pi(0,0);
Mat_<float> m(2,2);
m << 1.0f, 2.0f, 3.0f, 4.0f;
MatConstIterator_<float> ito(&m, pi);
cout <<(*ito) << endl;
in the end, maybe you should avoid writing code like this. anything "per-pixel" is slow and error prone.
2 | No.2 Revision |
MatConstIterator
(without any template brackets) defaults to MatConstIterator_<uchar>
so, that's the wrong type. try like:
Point2i pi(0,0);
Mat_<float> m(2,2);
m << 1.0f, 2.0f, 3.0f, 4.0f;
MatConstIterator_<float> ito(&m, pi);
cout <<(*ito) << endl;
in the end, maybe you should avoid writing code like this. anything "per-pixel" is slow and error prone.
p.s, if you ever need to print out uchar values, do it like this:
cout << int(value) << endl;
else it tries to print ascii (garbage)