索引地址:系列教程索引地址
Point()
Point()函数用于描述图片上面的二维点,比如Point(0,0)表示左上角的坐标原点。
下图为OpenCV坐标系,右横向为x轴正向。

使用方法1:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| #include <iostream> #include <vector> #include <opencv2/opencv.hpp>
using namespace std; using namespace cv;
int main(){ Point2f p(6, 2); cout << "【2维点】p = " << p << ";\n" << endl;
Point3f p3f(8, 2, 0); cout << "【3维点】p3f = " << p3f << ";\n" << endl;
vector<float> v; v.push_back(3); v.push_back(5); v.push_back(7);
vector<Point2f> points(20); for (size_t i = 0; i < points.size(); ++i) points[i] = Point2f((float)(i * 5), (float)(i % 7));
cout << "【二维点向量】points = " << points<<";"; }
|
测试输出为:
| 【2维点】p = [6, 2];
【3维点】p3f = [8, 2, 0];
【二维点向量】points = [0, 0; 5, 1;10, 2; 15, 3; 20, 4; 25, 5; 30, 6; 35, 0; 40, 1; 45, 2; 50, 3; 55, 4; 60, 5; 65, 6; 70, 0; 75, 1; 80, 2; 85, 3; 90, 4; 95, 5];%
|
输出中的百分号表示终端输出结束。
使用方法2:操作图片上面的某个点。
在后续介绍中在说。