Openv2.1基本数据类型
Posted wangduo
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Openv2.1基本数据类型相关的知识,希望对你有一定的参考价值。
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;
预定义:
typedef Point_<int> Point2i;
typedef Point2i Point;
typedef Point_<float> Point2f;
typedef Point_<double> Point2d;
Point3_(3维点类)
2、Size_
_Tp width, height;
typedef Size_<int> Size2i;
typedef Size2i Size;
typedef Size_<float> Size2f;
3、Rect_
_Tp x, y, width, height;
运算:
- (平移)
- (放缩)
- rect = rect1 & rect2 (矩形交集)
- rect = rect1 | rect2 (包含两矩形的最小区域 )
- rect == rect1, rect != rect1 (比较)
- typedef Rect_<int> Rect;
4. RotatedRect
Point2f center; Size2f size; float angle;
5、Vec
typedef Vec<uchar, 2> Vec2b;
typedef Vec<uchar, 3> Vec3b;
typedef Vec<uchar, 4> Vec4b;
typedef Vec<short, 2> Vec2s;
typedef Vec<short, 3> Vec3s;
typedef Vec<short, 4> Vec4s;
typedef Vec<int, 2> Vec2i;
typedef Vec<int, 3> Vec3i;
typedef Vec<int, 4> Vec4i;
typedef Vec<float, 2> Vec2f;
typedef Vec<float, 3> Vec3f;
typedef Vec<float, 4> Vec4f;
typedef Vec<float, 6> Vec6f;
typedef Vec<double, 2> Vec2d;
typedef Vec<double, 3> Vec3d;
typedef Vec<double, 4> Vec4d;
typedef Vec<double, 6> Vec6d;
6、Scalar_
template<typename _Tp> class Scalar_ : public Vec<_Tp, 4>
{
Scalar_(_Tp v0, _Tp v1, _Tp v2=0, _Tp v3=0);
Scalar_(const CvScalar& s);
Scalar_(_Tp v0);
static Scalar_<_Tp> all(_Tp v0);
}
typedef Scalar_<double> Scalar;
7、Range
class Range
{
public:
Range();
Range(int _start, int _end);
Range(const CvSlice& slice);
int size() const;
bool empty() const;
static Range all();
operator CvSlice() const;
int start, end;
};
以上是关于Openv2.1基本数据类型的主要内容,如果未能解决你的问题,请参考以下文章