一、C++

宽度:img.rows
高度:img.cols
通道数(depth):img.channels()
注意:channels是函数,别忘了后面的括号

 

二、Python

用shape()属性
shape[0]是宽度
shape[1]是高度
shape[2]是通道数(深度)
直接看图opencv获取图像的宽度、高度、通道数

相关文章: