代码改变世界

OpenCV Mat图像类型与图像深度的关系

2012-03-30 14:40  星空下  阅读(3177)  评论(0)    收藏  举报

1、Mat::type

Returns the type of a matrix element.
C++: int Mat::type() const
The method returns a matrix element type. This is an identifier compatible with the CvMat type system, like CV_16SC3
or 16-bit signed 3-channel array, and so on.

2、Mat::depth
Returns the depth of a matrix element.
C++: int Mat::depth() const
The method returns the identifier of the matrix element depth (the type of each individual channel). For example, for
a 16-bit signed 3-channel array, the method returns CV_16S .

由帮助的内容可知,type包含通道信息,例如CV_8UC3,而深度信息depth不包含通道信息,例如CV_8U.