原图:
获取图像常用属性
通过调用Mat类的公有成员变量,可以获取图像的标志位、尺寸、行高、列宽、图像维度等常用属性。
Mat类矩阵类型说明
int main()
{
namedWindow("image", WINDOW_AUTOSIZE);
Mat image;
image = imread("hai.png");
//image = Mat(240,320,CV_8UC3,Scalar(135,255,135));
cout << "-------------------- Print image parameters ----------------------"<<endl;
//标志位
cout << "flags:" << image.flags << endl;
//图像尺寸
cout << "size:" << image.size << endl;
//列宽
cout << "clos:" << image.cols<<endl;
//行高
cout << "rows:" << image.rows << endl;
//维度
cout << "dims:" << image.dims << endl;
imshow("image",image);
waitKey(0);
return 0;
}