vectorvectorint

/************************************************************************Copyright (C) 2015-2020.File name:Author:GreenappleQQ:361348440EMail:361348440@qq.comVersion:V1.0Date:2015/3/15Description: STL vector usageOthers:无Modification: 1.vector<vector<int>> 2.维数达到3维1. 2015/3/15 : 第一次编写完成。 ************************************************************************/ #include <iostream>#include <vector>#include <opencv2/core/core.hpp>#include <opencv2/highgui/highgui.hpp>#include <opencv2/imgproc/imgproc.hpp>using namespace std;const int TOTAL_NUM=4;const int DIM=3;vector<vector<int>>vec_pt;void readData3Dims(){freopen("input_3.txt","r",stdin);for(int i=0;i<TOTAL_NUM;++i){//int *temp=new int [DIM];//int temp[DIM];vector<int> vec_temp;for(int j=0;j<DIM;++j){int tmp;cin>>tmp;vec_temp.push_back(tmp);//cout<<vec_temp[j]<<" ";}//cout<<endl;vec_pt.push_back(vec_temp);}fclose(stdin);}int main(){readData3Dims();int vec_size=static_cast<int>(vec_pt.size());cv::Mat_<float> vec(vec_size,DIM);vec.setTo(0);for(int y=0;y<vec.rows;++y){for(int x=0;x<vec.cols;++x){vector<int> vec_tmp;vec_tmp=vec_pt[y];vec(y,x)=vec_tmp[x];}}//show vec;for(int y=0;y<vec.rows;++y){for(int x=0;x<vec.cols;++x){cout<<vec(y,x)<<" ";}cout<<endl;}return 0;}

,那么威尼斯就是一艘轻盈和流动的舟船,

vectorvectorint

相关文章:

你感兴趣的文章:

标签云: