直接上代码
img = cv::imread(name); //读取图片
int width = img.rows; //宽
int height = img.cols; //高
int channels=img.channels(); //获取通道数,返回值为int类型
qDebug()<<"source cwidth="<<width;
qDebug()<<"source height="<<height;
qDebug()<<"source channels="<<channels;