Opencv Mat 类 (一)

Opencv Mat 类 (一)

我有一个梦想,我写的代码,可以像诗一样优美。我有一个梦想,我做的设计,能恰到好处,既不过度,也无不足。

opencv,一直零零散散的看着,总没有沉下心来总结。
正好手里的项目涉及到了opencv的相关内容,趁着这个机会,总结回顾下,也算是巩固知识点了(总结的不对的地方,欢迎各位指正)。

opencv中一个很重要的点就是Mat类了,当然回顾也应该从这里开始,话不多说,上干货!
先上代码,再一一过。

void useMat()
{
	Mat img = imread("1.jpg", IMREAD_COLOR);//加载图片
	if (img.empty())
	{
		cout << "read picture failed";
		return;
	}

	cout << "flags = " << img.flags << endl;
	cout << "dims = " << img.dims << endl;//矩阵维度
	cout << "rows = " << img.rows << endl;//行数
	cout << "cols = " << img.cols << endl;//列数
	cout << "depths = " << img.depth() << endl;//深度
	
	cout << "channels = " << img.channels() << endl;//通道数
	cout << "iscontinuous = " << img.isContinuous() << endl;
	cout << "isSubMatrix() = " << img.isSubmatrix() << endl;
	cout << "type() = " << img.type() << endl;//类型


	Mat mat(2, 3, CV_64FC2, Scalar(1.0, 3.0));
	cout << "mat = " << endl << mat << endl;
	cout << "rows = " << mat.rows << endl;
	cout << "cols = " << mat.cols << endl;
	cout << "channel = " << mat.channels() << endl;
	cout << 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值