Point类数据结构表示了二维坐标系的点,即由其图像坐标x和y指定的点,用法如下:
Point point;
point.x = 10;
point.y = 5;
cout << point << endl;
或者:
Point point1 = Point(10, 5);
cout << point1 << endl;
另外,OpenCV中有如下定义:
typedef Point_<int> Point2i;
typedef Point2i Point;
typedef Point_<float> Point2f;
所以Point_<int>、Point2i、Point互为等价,Point_<float>、Point2f互为等价,因此以下几种方法是相同的:
//第一种
Point point1 = Point(10, 5);
cout << point1 << endl;
//第二种
Point_<int> point2;
point2.x = 3;
point2.y = 5;
cout << point2 << endl;
//第三种
Point2i point3 = Point2i(3, 4);
cout << point3 << endl;