opencv vector 测试


点击(此处)折叠或打开

  1. #include <iostream>
  2. #include <cv.h>
  3. #include <cxcore.h>
  4. #include <highgui.h>

  5. using namespace std;
  6. using namespace cv;

  7. int main( )
  8. {
  9. #if 1
  10.     //声明一个2维点向量,2列,自定义行数
  11.     vector<Point2f> vp2f;
  12.     //二维点向量赋值
  13.     vp2f.push_back(Point2f(3, 3));
  14.     cout << "【二维点向量】" << endl << vp2f << endl;
  15.     //定义4*2的矩阵,并赋值,若没有赋值,则默认为0
  16.     vector<Point2f> corners(4);
  17.     corners[0] = Point2f(0,0);
  18.     corners[1] = Point2f(200-1,0);
  19.     corners[2] = Point2f(0,300-1);
  20.     corners[3] = Point2f(200-1,300-1);
  21.     cout << "【corners(4)】" << endl << corners << endl;
  22.     //定义一个5*2的矩阵,未赋值,默认为0
  23.     vector<Point2f> corners_trans(5);
  24.     cout << "【corners_trans(5)】" << endl << corners_trans << endl;
  25.     //定义20*3的矩阵,并赋值
  26.     vector<Point3f> vp3f(20);
  27.     for (size_t i = 0; i < vp3f.size(); i++)
  28.     {
  29.         vp3f[i] = Point3f((float)(i + i), (float)(i * i), (float)(i + 1));
  30.     }
  31.     cout << "【三维点向量】" << endl << vp3f << endl;
  32.   
  33. #endif
  34.      system("pause");
  35.     cvWaitKey(50000);
  36.     return 0;
  37. }


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26129555/viewspace-2140947/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/26129555/viewspace-2140947/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值