C++ – How to convert CV_8UC1 to normal int type

copencv

I'm having a problem with understanding the opencv types. I have matrix in CV_8UC1 type but how can I read value of elements in matrix?

I know that I have to use at method and then pas <here> my type but what type is CV_8UC1? 8 unsigned bit single channel doesn't tell me much.

Can i do something like this:
unsigned int a = mat->at(0,0);

Best Answer

From the OpenCV Reference Manual:

CV_8UC1 – unsigned 8-bit single-channel data; can be used for grayscale image or binary image – mask.

So it's just single channel 8 bit grey scale with values 0..255.