opencv中的基本数据结构

enum { CV_8U=0, CV_8S=1, CV_16U=2, CV_16S=3, CV_32S=4, CV_32F=5, CV_64F=6 };

 Point_  二维点坐标(x,y)

typedef Point_ Point2i;
typedef Point2i Point;
typedef Point_ Point2f;
typedef Point_ Point2d;

Point3_ 3维点坐标(x,y,z)

typedef Point3_ Point3i;
typedef Point3_ Point3f;
typedef Point3_ Point3d;

Size_  尺寸(width, height)

typedef Size_ Size2i;
typedef Size2i Size;
typedef Size_ Size2f;

Rect_  矩形区域(x,y,width,height) ,(x,y)左上角坐标, 范围[x, x + width), [y, y + height)

rect = rect ± point //矩形偏移(shifting a rectangle by a certain offset)
rect = rect ± size //改变大小(expanding or shrinking a rectangle by a certain amount)
rect += point, rect -= point, rect += size, rect -= size //(augmenting operations)
rect = rect1 & rect2 //矩形交集(rectangle intersection)
rect = rect1 | rect2 //包含r1r2的最小矩形(minimum area rectangle containing rect2 and rect3 )
rect &= rect1, rect |= rect1 //(and the corresponding augmenting operations)
rect == rect1, rect != rect1 //(rectangle comparison)

Vec  短向量,基于Matx

template class Vec : public Matx<_Tp, n, 1> {...};
typedef Vec Vec2b;
typedef Vec Vec3b;
typedef Vec Vec4b;
typedef Vec Vec2s;
typedef Vec Vec3s;
typedef Vec Vec4s;
typedef Vec Vec2i;
typedef Vec Vec3i;
typedef Vec Vec4i;
typedef Vec Vec2f;
typedef Vec Vec3f;
typedef Vec Vec4f;
typedef Vec Vec6f;
typedef Vec Vec2d;
typedef Vec Vec3d;
typedef Vec Vec4d;
typedef Vec Vec6d;

Scalar_  四维向量

template class Scalar_: public Vec<_Tp, 4> { ... };
typedef Scalar_ Scalar;

 Mat 矩阵结构

  • M.data  数据区域的指针
  • M.dims  矩阵维度
  • M.sizes  维度
  • M.elemSize()  每个元素占的字节空间大小,与元素类型相关,如CV_8U
  • M.step[]  用来计算元素地址, M.step[i] 表示所有比i大的维度所占空间大小
     

参考:https://www.cnblogs.com/guoqiaojin/p/3176692.html

https://docs.opencv.org/2.4/modules/core/doc/old_basic_structures.html

 

 

 

你可能感兴趣的:(Opencv系列)