Call Mat.channels()
:
cv::Mat img(1,1,CV_8U,cvScalar(0));
std::cout<<img.channels();
Output:
1
which is the number of channels.
Also, try:
std::cout<<img.type();
Output:
0
which belongs to CV_8U (look here at line 542). Study file types_c.h
for each define
.