0xC0000005:访问冲突读取位置0xFFFFFFFFFFFFFFFF。当从opencv使用glob时

时间:2017-09-20 03:27:52

标签: c++ visual-studio opencv glob access-violation

我想知道这里有什么问题?

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的文件夹中。

有什么想法? enter image description here

enter image description here

更新: 但是,逐个访问图像有效:

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

0 个答案:

没有答案