点击(此处)折叠或打开
-
#include <iostream>
-
#include <cv.h>
-
#include <cxcore.h>
-
#include <highgui.h>
-
-
using namespace std;
-
using namespace cv;
-
-
int main( )
-
{
-
#if 1
-
//声明一个2维点向量,2列,自定义行数
-
vector<Point2f> vp2f;
-
//二维点向量赋值
-
vp2f.push_back(Point2f(3, 3));
-
cout << "【二维点向量】" << endl << vp2f << endl;
-
//定义4*2的矩阵,并赋值,若没有赋值,则默认为0
-
vector<Point2f> corners(4);
-
corners[0] = Point2f(0,0);
-
corners[1] = Point2f(200-1,0);
-
corners[2] = Point2f(0,300-1);
-
corners[3] = Point2f(200-1,300-1);
-
cout << "【corners(4)】" << endl << corners << endl;
-
//定义一个5*2的矩阵,未赋值,默认为0
-
vector<Point2f> corners_trans(5);
-
cout << "【corners_trans(5)】" << endl << corners_trans << endl;
-
//定义20*3的矩阵,并赋值
-
vector<Point3f> vp3f(20);
-
for (size_t i = 0; i < vp3f.size(); i++)
-
{
-
vp3f[i] = Point3f((float)(i + i), (float)(i * i), (float)(i + 1));
-
}
-
cout << "【三维点向量】" << endl << vp3f << endl;
-
-
#endif
-
system("pause");
-
cvWaitKey(50000);
-
return 0;
- }
