0

我需要.txt从文件夹中加载一些图像和一个文件,以便像这里一样使用 OpenCV 3.0.0 创建一个 HDR 图像。Xcode 似乎与 OpenCV 3.0.0 链接,因为其他代码示例工作,当我给出完整路径时加载图像。如何.txt像在 VS2010 中那样直接从参数加载图像和文件?我需要使用示例中的代码。

    void loadExposureSeq(String path, vector<Mat>& images, vector<float>& times)
{
    path = path + std::string("/");
    ifstream list_file((path + "list.txt").c_str());
    string name;
    float val;
    while(list_file >> name >> val) {
        Mat img = imread(path + name);
        images.push_back(img);
        times.push_back(1 / val);
    }
    list_file.close();
}

我尝试输入完整路径,std::string("/")但没有成功。我对Xcode很陌生,请帮忙!

4

0 回答 0