# getting out of arguments

The problem i'm trying to build something around the openvc advanced stitching solver. (the lower level API).
However that asumes all is given in command line arguments, this is not practical for me. Is there a way to provide inline code to add an image series ?
So without using command line arguments, I need this essentially for all arguments.

be able to do in psudo code
args.images = "c:\img\plan1 c:\imgplan2 c:\imgplan3"

edit retag close merge delete

Sort by » oldest newest most voted

Another solution that I often use is to create a text file containing the image names and pass that filename as argument.

The text file can be created with ls *.jpg > process.txt (or dir *.jpg > process.txt in Windows).

Then read the file line by line:

ifstream myfile(argv[1]);
while(!myfile.eof()){
getline(myfile,imagefilename);
//...process img...
}
myfile.close();

more

those samples are not "written in stone", you're allowed (and even encouraged !) to hack them to fit your needs ;)

see, the only thing required here is that you fill the vector<String> img_names; list from the argument parsing, so maybe you can make good use of cv::glob() and (assuming, your image names can be nicely sorted lexicographically), add a case like:

    else if (string(argv[i]) == "--folder")
{
string folder = argv[i+1];
i++;
cv::glob(folder, img_names); // read folder content into img_names
}


to the cmdline parsing.

note: you probably need images numbered like: img007 (leading zeros), else img10 comes after img1 and before img2 !

more

Official site

GitHub

Wiki

Documentation