OpenCV基本数据类型
来源:互联网 发布:淘宝达人网址是多少 编辑:程序博客网 时间:2024/05/16 09:43
Point_
typedef Point_<int> Point2i;typedef Point2i Point;typedef Point_<float> Point2f;typedef Point_<double> Point2d;
Point3_
typedef Point3_<int> Point3i;typedef Point3_<float> Point3f;typedef Point3_<double> Point3d;
Size_
typedef Size_<int> Size2i;typedef Size2i Size;typedef Size_<float> Size2f;
Rect_
typedef Rect_<int> Rect;
Matx
typedef Matx<float,1,2> Matx12f;typedef Matx<double,1,2> Matx12d;...
Vec
typedef Vec<uchar, 2> Vec2b;typedef Vec<short,3> Vec3s;typedef Vec<int, 4> Vec4i;typddef Vec<float,6> Vec6i;...
Scalar_
typedef Scalar_<double> Scalar;
Range
class Range{public:...int start, end;};
ex:取A的全部行,和 1到180列
Mat A = imread("b.jpg", CV_LOAD_IMAGE_COLOR);Mat B = A(Range::all(), Range(1, 180));
Mat
创建复杂的矩阵
// make a 7x7 complex matrix filled with 1+3j.Mat M(7,7,CV_32FC2,Scalar(1,3));// and now turn M to a 100x60 15-channel 8-bit matrix.// The old content will be deallocatedM.create(100,60,CV_8UC(15));多维数组
// create a 100x100x100 8-bit arrayint sz[] = {100, 100, 100};Mat bigCube(3, sz, CV_8U, Scalar::all(0));矩阵行操作
// add the 5-th row, multiplied by 3 to the 3rd rowM.row(3) = M.row(3) + M.row(5)*3;
矩阵列操作
// now copy the 7-th column to the 1-st column// M.col(1) = M.col(7); // this will not workMat M1 = M.col(1);M.col(7).copyTo(M1);
locateROI使用
Mat A = Mat::eye(10, 10, CV_32S);// extracts A columns, 1 (inclusive) to 3 (exclusive).Mat B = A(Range::all(), Range(1, 3));// extracts B rows, 5 (inclusive) to 9 (exclusive).// that is, C ~ A(Range(5, 9), Range(1, 3))Mat C = B(Range(5, 9), Range::all());Size size; Point ofs;C.locateROI(size, ofs);// size will be (width=10,height=10) and the ofs will be (x=1, y=5)
矩阵元素访问:
指针加[ ]
int sum = 0;Mat M = Mat::eye(20, 20, CV_8UC1);for (int i=0; i < M.rows; i++){const uchar* mi = M.ptr<uchar>(i);for (int j=0; j < M.cols; j++){sum += mi[j];}}
迭代
MatConstIterator_<uchar> it = M.begin<uchar>(), it_end = M.end<uchar>();for (; it != it_end; ++it)sum += *it;
- 【opencv】OpenCv的基本数据类型
- opencv基本数据类型
- OpenCV基本数据类型
- OpenCV基本数据类型
- OpenCV基本数据类型
- OpenCV基本数据类型
- opencv基本数据类型
- OpenCV基本数据类型
- 【OpenCV】基本数据类型
- openCV基本数据类型
- OpenCV基本数据类型
- OpenCV基本数据类型
- opencv基本数据类型
- opencv基本数据类型
- OpenCV学习笔记 -- 基本数据类型
- OpenCV的多种基本数据类型
- OpenCV 学习笔记---基本数据类型
- OpenCV的多种基本数据类型
- 50款经典iPhone开源应用及源码
- myEclipse 转换工作空间后需重新配置jdk
- 用Eclipse调试Android x86
- 破解完全入门篇 第四章--调试器及相关工具入门
- 通过Enumeration和Iterator遍历Hashtable的效率分析
- OpenCV基本数据类型
- Linux输入子系统分析 (1) -- 输入子系统初始化
- Reading list for cortical modeling and unsupervised feature learning
- 破解完全入门篇
- simple use
- javascript中的Math
- struts标签使用
- Exchange 导出用户数据
- 微软新推出蓝牙键盘,兼容Windows、Android平板和iPad