This maybe rudimentary, but is it possible to know how many channels a cv::Mat
has? For eg, we load an RGB image, I know there are 3 channels. I do the followin
you might use:
Mat::channels()
http://docs.opencv.org/modules/core/doc/basic_structures.html#mat-channels
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
.