In the C++ interface to OpenCV, it seems easy enough to check the type of an image. If you have an image cv::Mat img = cv::imread("someImage.xyz")
, you just do int theType = img.type()
.
However, as you would expect, calling img.type()
just gives an integer, an not an enum name (e.g. CV_32FC1
).
Is there an easy way to print out the enum name (e.g. CV_32FC1
) if I know the integer value of the OpenCV enum?
Following @Bob's advice, I wrote my own function to solve this problem. Here it is:
Did I forget to include any OpenCV image types in my lookup table?
To my knowledge, such a function doesn't exist in OpenCV.
I think you would be better off writing your own function to get those. A lot of switch cases but I guess it does the job. The enumeration can be found here.
EDIT:
This is something you could use to extract the types. I am guessing there could be a more efficient method, but I can't wrap my head around it right now.