opencv 2.4 中如何更改Mat尺寸

来源:互联网 发布:oracle数据库监听配置 编辑:程序博客网 时间:2024/06/11 04:54

采用函数reshape

Changes the shape and/or the number of channels of a 2D matrix without copying the data.

Mat Mat::reshape(int cn, int rows=0) const
代码如下:
Mat mat(4,4,CV_8UC3);Mat mat1=mat.reshape(3,16); 
将4*4的3通道mat转换成1*16的单通道mat1;
注意: 第一个参数是通道的数目

原创粉丝点击