2017-09-20 7 views
0

나는 무엇이 잘못되었는지 궁금합니다.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.cppZ:\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); 
+1

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

+0

그래서 무엇이 정확합니까? 한 줄로 수정할 수 있습니까? –

+3

'경로 '가 맞습니까? 파일 이름 와일드 카드 앞에 백 슬래시가 하나만 있습니다. – 1201ProgramAlarm

답변

0

귀하의 코드가 완벽하게 나를 위해 잘 작동! 이 정확한 코드 사본입니까? 여기에 \이 누락되었으므로 assets\*.jpg입니다.

+0

오, 그게 실수 였어. 나는 \\을 가지고 있으며 여전히 같은 오류가 있습니다! 질문을 업데이트하겠습니다. –

관련 문제