Building Computer Vision Projects with OpenCV 4 and C++
上QQ阅读APP看书,第一时间看更新

Point object type

Another very common class template is Point. This class defines a 2D point specified by its coordinates x and y.

Like Point, there is a Point3 template class for 3D point support.

Like the Vec class, OpenCV defines the following Point aliases for our convenience:

typedef Point_<int> Point2i; 
typedef Point2i Point; 
typedef Point_<float> Point2f; 
typedef Point_<double> Point2d; 
 The following operators are defined for points:
pt1 = pt2 + pt3;
pt1 = pt2 - pt3; pt1 = pt2 * a; pt1 = a * pt2; pt1 = pt2 / a; pt1 += pt2; pt1 -= pt2; pt1 *= a; pt1 /= a; double value = norm(pt); // L2 norm pt1 == pt2; pt1 != pt2;