主要是以下类的属性调用
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