for (int i=1; i<n+1; i++) {
vector<String> temp;
folder = pathName + to_string(i) + "/*.jpg";
glob(folder, temp);
filenames.push_back(temp);
}
我想在python中写这个。我已设法做下面的代码,但我正在努力与推回功能。
for i in range(1,n):
print(i)
folder = path + str(i)
print folder
files = [f for f in listdir(folder) if isfile(join(folder, f))]
#need to push values to a vector (vector<vector<string>>)
break
我怎样才能在python中执行类似功能的回退?
答案 0 :(得分:0)
for i in range(1,n):
print(i)
folder = path + str(i)
print folder
files = [f for f in listdir(folder) if isfile(join(folder, f))]
#need to push values to a vector "filenames' (vector<vector<string>>)
filenames.append(fiels). #or filenames.extend(files)
break
那么这将做什么与opencv中的回推功能相同。每次更新矢量文件(包含目录中的文件名)时,它都会回退到文件名向量。