1、Point_
template<typename _Tp> class Point_
{_Tp x, y;}
可使用的运算:
pt1 = pt2 + pt3;
pt1 = pt2 - pt3;
pt1 = pt2 * a;
pt1 = a * pt2;
pt1 += pt2;
pt1 -= pt2;
pt1 *= a;
double value = norm(pt); // L2 norm
pt1 == pt2;
pt1 != pt2;
预定义:
1 typedef Point_<int> Point2i; 2 typedef Point2i Point; 3 typedef Point_<float> Point2f; 4 typedef Point_<double> Point2d;
Point3_(3维点类)
2、Size_
1 _Tp width, height; 2 typedef Size_<int> Size2i; 3 typedef Size2i Size; 4 typedef Size_<float> Size2f;
3、Rect_
1 _Tp x, y, width, height; 2 typedef Rect_<int> Rect;
运算:
- (平移)
- (放缩)
- rect = rect1 & rect2 (矩形交集)
- rect = rect1 | rect2 (包含两矩形的最小区域 )
- rect == rect1, rect != rect1 (比较)
4. RotatedRect
Point2f center; Size2f size; float angle;
5、Vec
1 typedef Vec<uchar, 2> Vec2b; 2 typedef Vec<uchar, 3> Vec3b; 3 typedef Vec<uchar, 4> Vec4b; 4 5 typedef Vec<short, 2> Vec2s; 6 typedef Vec<short, 3> Vec3s; 7 typedef Vec<short, 4> Vec4s; 8 9 typedef Vec<int, 2> Vec2i; 10 typedef Vec<int, 3> Vec3i; 11 typedef Vec<int, 4> Vec4i; 12 13 typedef Vec<float, 2> Vec2f; 14 typedef Vec<float, 3> Vec3f; 15 typedef Vec<float, 4> Vec4f; 16 typedef Vec<float, 6> Vec6f; 17 18 typedef Vec<double, 2> Vec2d; 19 typedef Vec<double, 3> Vec3d; 20 21 typedef Vec<double, 4> Vec4d; 22 typedef Vec<double, 6> Vec6d;
6、Scalar_
1 template<typename _Tp> class Scalar_ : public Vec<_Tp, 4> 2 { 3 Scalar_(_Tp v0, _Tp v1, _Tp v2=0, _Tp v3=0); 4 Scalar_(const CvScalar& s); 5 Scalar_(_Tp v0); 6 static Scalar_<_Tp> all(_Tp v0); 7 } 8 9 typedef Scalar_<double> Scalar;
7、Range
1 class Range 2 { 3 public: 4 Range(); 5 Range(int _start, int _end); 6 Range(const CvSlice& slice); 7 int size() const; 8 bool empty() const; 9 static Range all(); 10 operator CvSlice() const; 11 12 int start, end; 13 };