我想知道这里有什么问题?
String path = "Z:\\Cs585\\HW2\\draft\\hw2-kim\\hw2-kim\\assets\\*.jpg";
//String path = "assets\\*.jpg";
vector<String> fn;
glob(path, fn, false);
vector<Mat> handTemplates;
for (auto filename : fn){
Mat temp_hand = imread(filename);
handTemplates.push_back(temp_hand);
}
它崩溃并在vector<Mat> handTemplates;
行提供访问冲突。
基本上,main.cpp
位于Z:\Cs585\HW2\draft\hw2-kim\hw2-kim
目录中,我想以批处理方式使用imread打开的图像位于名为assets
的文件夹中。
更新: 但是,逐个访问图像有效:
vector<Mat> handTemplates;
Mat fist_hand = imread("assets\\fist.jpg");
handTemplates.push_back(fist_hand);
Mat full_hand = imread("assets\\full_hand.jpg");
handTemplates.push_back(full_hand);
Mat thumbs_up_hand = imread("assets\\thumbs_up.jpg");
handTemplates.push_back(thumbs_up_hand);
Mat victory_hand = imread("assets\\victory.jpg");
handTemplates.push_back(victory_hand);