I am kind of confused with type()
method of Mat
object in OpenCV.
If I have following lines:
mat = imread("C:\someimage.jpg");
type = mat.type();
and type = 16
, how do I find out what type of mat
matrix is?.
I tried to find the answer in its manual and in a couple of books in vain.
Here is a handy function you can use to help with identifying your opencv matrices at runtime. I find it useful for debugging, at least.
If
M
is a var of typeMat
you can call it like so:Will output data such as:
Its worth noting that there are also Matrix methods
Mat::depth()
andMat::channels()
. This function is just a handy way of getting a human readable interpretation from the combination of those two values whose bits are all stored in the same value.