Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

please AVOID to use Mat::at as good as you can. in 95% of all cases it's the wrong thing to do.

to print out a 1 pixel Mat use:

cout << sobel_x(Rect(100, 100, 1, 1)) << endl;

this solves 3 problems:

  • you don't have to mess with the type
  • you don't have to mess with indexing (you did it wrong above, in a 1x1 Matrix, (0,0) is the only valid index, (1,1) is out of bounds))
  • you don't have to care, if cout treats your uchar values as ascii

please AVOID to use Mat::at as good as you can. in 95% of all cases it's the wrong thing to do.

to print out a 1 pixel Mat use:

cout << sobel_x(Rect(100, 100, 1, 1)) << endl;

this solves 3 problems:

  • you don't have to mess with the typetype. (what is ddepth, and why do you assume uchar here ?)
  • you don't have to mess with indexing (you did it wrong above, in a 1x1 Matrix, (0,0) is the only valid index, (1,1) is out of bounds))
  • you don't have to care, if cout treats your uchar values as ascii