1 | initial version |
I think you are missing the difference between dst.depth() and dst.type().
Function depth() returns information about type of data stored in image. It can be unsigned char (CV_8U), signed char (CV_8S), unsigned short (CV_16U), and so on... In your case (unsigned char) depth is CV_8U. Also don't forget that CV_8U is something created for user convenience only (through macro). Its actual value is 0. Value of CV_8S is 1 ... value of CV_64F is 6. And that is exactly what you got by calling dst.depth().
Function type() returns information combined from 2 values: image depth + number of channels. It can be for example CV_8UC1 (which is equal to CV_8U), CV_8UC2, CV_8UC3, CV_8SC1 (which is equal to CV_8S), and so on... If you used dst.type() you would get value different from 0.
Anyway don't use those integers values directly. This is inconvenient, creates unreadable code, and may lead to bugs if some future version of OpenCV will change the way it stores this information. Instead use functions and typedefs of OpenCV. Here some examples:
if (dst.depth() == CV_8U)
cout << "Unsigned char image" << endl;
cout << "Number of channels is: " << dst.channels() << endl;
Mat tmp(dst.size(),dst.type());