0

I need to load some images and a .txt file from folder in order to create an HDR image with OpenCV 3.0.0 like here. Xcode seems to be linked with OpenCV 3.0.0 as other code samples work, images are loaded when I give the full path. How can I load images and .txt files directly from argument like I do in VS2010? I need to use the code as it is in the example.

    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();
}

I tried to enter the full path in std::string("/") but it didn't work. I am very new to Xcode, please help!

user_3849
  • 106
  • 1
  • 11
  • 1
    Can this question be boiled down to "How do I specify command-line arguments when running a program from Xcode ? [If so, **read this**](http://stackoverflow.com/a/14815947/1322972). – WhozCraig Nov 23 '14 at 13:11
  • Good to know. However, I still have the same error OpenCV Error: `Assertion failed (!images.empty()) in checkImageDimensions, file /Users/johnaros/Desktop/opencv/modules/photo/src/hdr_common.cpp, line 51 libc++abi.dylib: terminating with uncaught exception of type cv::Exception: /Users/johnaros/Desktop/opencv/modules/photo/src/hdr_common.cpp:51: error: (-215) !images.empty() in function checkImageDimensions` – user_3849 Nov 23 '14 at 13:25
  • The test code needs to have the whole folder that contain all files as an argument. I put the full path of the whole folder under edit scheme setting. Is that correct? – user_3849 Nov 23 '14 at 13:30

0 Answers0