opencv学习日记——col.range()的用法
#include<iostream>
#include<opencv2/opencv.hpp>
using namespace std;
using namespace cv;
int main()
{
float b[4] = {1.0, 2.0, 3.0, 4.0};
Mat a = Mat(2, 2, CV_32FC1, b);
Mat c, d, e;
//取第2列 0:第一列 1:第二列
c = a.col(1);
//取第2列的 0和1位置的值
d = c.rowRange(0, 2);
//取第2列的 0位置的值
e = c.rowRange(0, 1);
cout << "a: " << a << endl;
cout << "c: " << c << endl;
cout << "d: " << d << endl;
cout << "e: " << e << endl;
}
‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘
a: [1, 2;
3, 4]
c: [2;
4]
d: [2;
4]
e: [2]