ここで何が間違っているのだろうか?0xC0000005:0xFFFFFFFFFFFFFFFFの場所を読み取るアクセス違反。 OpenCVからglobを使用する場合
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
というフォルダ内にあります。
更新: ただし、アクセスした画像1作品ずつ:
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);
Windowsを使用していますか?その場合、[std :: string](https://stackoverflow.com/a/26536198/501196)または[cv :: String](http://)の代わりにATL/MFC Stringクラスを使用していると思います。 /docs.opencv.org/trunk/d1/d8f/classcv_1_1String.html) – yms
それで何が正しいのですか?それをラインで修正できますか? –
'path'は正しいですか?ファイル名のワイルドカードの前にバックスラッシュが1つだけあります。 – 1201ProgramAlarm