将vector转为mat

    string file = "../data/sumsum.txt";//test.txt
    ifstream infile;
    infile.open(file);
    if(!infile) {
        cout << "error" << endl;
    }
    // string str;
    double temp;
    vector<float> Data;
    while(infile >> temp) {
        Data.push_back(temp);
    }

    Mat mat_a(Data);
    cout << mat_a.size() << endl;
发布了37 篇原创文章 · 获赞 5 · 访问量 2187

猜你喜欢

转载自blog.csdn.net/weixin_44723106/article/details/103293885