Mat, vector<point2f>,Iplimage等等常见类型转换
来源:互联网 发布:矩阵扰动 编辑:程序博客网 时间:2024/04/30 10:07
(转)Mat, vector<point2f>,Iplimage等等常见类型转换
原文连接:http://blog.csdn.net/foreverhehe716/article/details/6749175
在mfc c++ 以及opencv 编写程序当中,很多常用的类型转换,现在总结一下。(注意加相应的头文件,这里不罗嗦)
提纲:
1. Mat ---> Iplimage
2. Iplimage ---> CvvImage
3. Mat ---> vector<Point2f> or vector<Point3f>
4. vector<Point2f> or vector<Point3f> ---> vector<vector<Point2f>> or vector<vector<Point3f>>
5. vector<vector<Point2f>> or vector<vector<Point3f>> ---> Mat
6. vector<Point2f> or vector<Point3f> ---> Mat
图像类
1. Mat ---> Iplimage :直接赋值
Mat img; Iplimage myImg = img;
2. Iplimage ---> CvvImage :用“Copyof ”
CvvImage cImg; Iplimage myimg; cImg.Copyof(myimg, -1);
数据类
3. Mat ---> vector<Point2f> or vector<Point3f> :用“Mat_<Point2f>“ ,“Mat_<Point3f>”
Mat m; vector<Point3f> p; p = Mat_<Point3f>(m);
4. vector<Point2f> or vector<Point3f> ---> vector<vector<Point2f>> or vector<vector<Point3f>> :用“pushback”
vector<Point3f> p1,p2,p3;vector<vector<Point3f>> pp;pp.pushback(p1);pp.pushback(p2);pp.pushback(p3);
5. vector<vector<Point2f>> or vector<vector<Point3f>> ---> Mat
vector<vector<Point3f>> p;Mat pm((int)p.size(), p[0].size(), CV_32FC3);for( int i = 0; i < (int)p.size(); i++ ){ Mat r = pm.row(i).reshape(3, pm.cols); Mat pm1(p[i]); pm1.copyTo(r);}
6. vector<Point2f> or vector<Point3f> ---> Mat :用“Mat(Point3f)"
vector<Point3f> p;Mat m = Mat(p);
- Mat, vector<point2f>,Iplimage等等常见类型转换
- Mat, vector<point2f>,Iplimage等等常见类型转换
- Mat, vector<point2f>,Iplimage等等常见类型转换
- Mat, vector<point2f>,Iplimage等等常见类型转换
- Mat, vector<point2f>,Point3d Iplimage等等常见类型转换
- Mat, vector<point2f>,Iplimage等等常见类型转换
- Mat, vector<point2f>,Iplimage等等常见类型转换
- Mat转换成IplImage类型
- Mat转换成IplImage类型
- Mat和iplimage类型转换
- 【OpenCV】cv::Mat与IplImage类型转换
- JavaCV中将Mat类型转换成IplImage
- Mat 与IplImage *类型相互转换
- Mat与IplImage*类型间的转换
- OpenCV中Mat,IplImage,CVMat类型转换
- Mat类型与IplImage之间的转换
- vector和QMap简单使用记忆qt中QPointF类型和CV中Point2f和Mat的使用细节,
- cv::Mat类型数据和IplImage类型数据的转换
- ios block初级使用
- DSP6000的上电及供电
- jquery flot 在节点上显示提示
- UVA 1423 - Guess(拓扑排序)
- NIO组件Selector调用实例
- Mat, vector<point2f>,Iplimage等等常见类型转换
- 上位机与PLC通讯及OPC数据采集实践一
- 在openshift上构建自己的应用
- How to Find the Offending SQL from a ORA-600 or ORA-7445 Trace File (文档 ID 154170.1)转到底部 In this
- 由集成电流传感器MAX471构成±3A电流监测仪的电路
- 读书札记-2013年12月
- DSP6000的几个简单优化技巧
- String类型是不可变的
- c++ 容器的iterator的时间复杂度问题