Created
June 27, 2015 17:49
-
-
Save hG3n/f896b5f9611124dc82de to your computer and use it in GitHub Desktop.
function to print the type of a matrix by passing Mat.type() as argument
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
std::string type2str(int type) { | |
std::string r; | |
uchar depth = type & CV_MAT_DEPTH_MASK; | |
uchar chans = 1 + (type >> CV_CN_SHIFT); | |
switch ( depth ) { | |
case CV_8U: r = "8U"; break; | |
case CV_8S: r = "8S"; break; | |
case CV_16U: r = "16U"; break; | |
case CV_16S: r = "16S"; break; | |
case CV_32S: r = "32S"; break; | |
case CV_32F: r = "32F"; break; | |
case CV_64F: r = "64F"; break; | |
default: r = "User"; break; | |
} | |
r += "C"; | |
r += (chans+'0'); | |
return r; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment