C++之opencv的cv::Mat

主要是以下类的属性调用

void test_variable()
{
	cv::Mat macro = cv::imread("D:/EEE.jpg"); //
 
	cout << "macro.step:" << macro.step << endl;
	cout << "macro.step[0]:" << macro.step[0] << endl;
	cout << "macro.step[1]:" << macro.step[1] << endl;
	cout << "macro.step1():" << macro.step1() << endl;
	cout << "macro.size:" << macro.size << endl;
	cout << "macro.size[0]:" << macro.size[0] << endl;
	cout << "macro.size[1]:" << macro.size[1] << endl;
	cout << "macro.channels():" << macro.channels() << endl;
	cout << "macro.depth():" << macro.depth() << endl;
	cout << "macro.elemSize:" << macro.elemSize() << endl;
	cout << "macro.elemSize1:" << macro.elemSize1() << endl;
 
 
	cv::Mat t(100, 100, CV_16UC3);
	cout << "t.step:" << t.step << endl;
	cout << "t.step[0]:" << t.step[0] << endl;
	cout << "t.step[1]:" << t.step[1] << endl;
	cout << "t.step1():" << t.step1() << endl;
	cout << "t.size:" << t.size << endl;
	cout << "t.size[0]:" << t.size[0] << endl;
	cout << "t.size[1]:" << t.size[1] << endl;
	cout << "t.channels():" << t.channels() << endl;
	cout << "t.depth():" << t.depth() << endl;
	cout << "t.elemSize:" << t.elemSize() << endl;
	cout << "t.elemSize1:" << t.elemSize1() << endl;
 
 
	cv::Mat s(100, 100, CV_32SC3);
	cout << "s.step:" << s.step << endl;
	cout << "s.step[0]:" << s.step[0] << endl;
	cout << "s.step[1]:" << s.step[1] << endl;
	cout << "s.step1():" << s.step1() << endl;
	cout << "s.size:" << s.size << endl;
	cout << "s.size[0]:" << s.size[0] << endl;
	cout << "s.size[1]:" << s.size[1] << endl;
	cout << "s.channels():" << s.channels() << endl;
	cout << "s.depth():" << s.depth() << endl;
	cout << "s.elemSize():" << s.elemSize() << endl;
	cout << "s.elemSize1:" << s.elemSize1() << endl;
}

输出结果如下所示:

macro.step:810
macro.step[0]:810
macro.step[1]:3
macro.step1():810
macro.size:190 x 270
macro.size[0]:190
macro.size[1]:270
macro.channels():3
macro.depth():0
macro.elemSize:3
macro.elemSize1:1
t.step:600
t.step[0]:600
t.step[1]:6
t.step1():300
t.size:100 x 100
t.size[0]:100
t.size[1]:100
t.channels():3
t.depth():2
t.elemSize:6
t.elemSize1:2
s.step:1200
s.step[0]:1200
s.step[1]:12
s.step1():300
s.size:100 x 100
s.size[0]:100
s.size[1]:100
s.channels():3
s.depth():4
s.elemSize():12
s.elemSize1:4

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值