f:\opencv\opencv\sources\modules\core\src\matrix.cpp:
  flags = (_type & CV_MAT_TYPE_MASK) | MAGIC_VAL;
 
  CV_MAT_TYPE_MASK: =8*4-1=31, 5bits
  #define CV_MAT_TYPE_MASK        (CV_DEPTH_MAX*CV_CN_MAX - 1)
 
  MAGIC_VAL:
  MAGIC_VAL  = 0x42FF0000
 
  _type:
  #define CV_32SC1 CV_MAKETYPE(CV_32S,1)
  #define CV_MAKETYPE(depth,cn) (CV_MAT_DEPTH(depth) + (((cn)-1) << CV_CN_SHIFT))
 
  CV_32SC1 = CV_32S &7 | (1-1)<<3 =4

已知Mat,如何获取她的dewpth, channel?

f:\opencv\opencv\sources\modules\core\src\arithm.cpp:

int type1 = psrc1->type(), depth1 = CV_MAT_DEPTH(type1), cn = CV_MAT_CN(type1);

05-11 22:04