2014-01-13 1 views
0

LSH를 사용하여 검색 속도를 높이고 싶습니다. LshIndexParams를 사용하여 opencv flann에서이 작업을 수행 할 수 있습니까? 문제는 내가 형식을 얻을 수 없다는 것입니다. 나는 단어의 가방을 사용하여 매트 출력을 생성하고 flann에 피드하지만, 항상 오류가 발생합니다.LshIndexParams를 사용하여 flann 인덱스에 필요한 데이터 유형은 무엇입니까?

OpenCV Error: Unsupported format or combination of formats (type=2 

) buildIndex_에서, 파일 /home/vampire/opencv-2.4.8/modules/flann/src/miniflann.cpp, 라인 (315) 는 '이력서 :: 예외' 의 인스턴스를 던지는 후에 호출 종료 what() : /home/vampire/opencv-2.4.8/modules/flann/src/miniflann.cpp:315 : 오류 : (-210) type = 2 function in buildIndex_

코드 부분에 다음이 있습니다. :

Mat img_BOWdescriptor=BOW_descriptors(path); 
cout<<img_BOWdescriptor<<endl; 
img_BOWdescriptor.convertTo(img_BOWdescriptor,img_BOWdescriptor.rows,img_BOWdescriptor.cols,CV_32F); 
cout<<img_BOWdescriptor<<endl; 
cout<<"done"<<endl; 

cout<<"ini flann index......"<<endl; 
Mat indices = Mat(img_BOWdescriptor.rows, 1, CV_32S); 
Mat dist = Mat(img_BOWdescriptor.rows, 1, CV_32F); 
descriptors_all.convertTo(descriptors_all,descriptors_all.rows,descriptors_all.cols,CV_32F); 

flann::Index* flann_index=new flann::Index(descriptors_all,flann::LshIndexParams(20,10,2)); 
cout<<"done"<<endl; 
double t=(double)getTickCount(); 

cout<<"flann matching......"<<endl; 
flann_index->knnSearch(img_BOWdescriptor, indices, dist, 1,flann::SearchParams(32)); 

그리고 다른 유형으로 변환하려고 시도했지만 아무도 작동하지 않습니다. 아무도 그것을하는 방법을 알고 있습니까? 그리고 결과가 나온 후에 어떻게 일치하는지 어떻게 알 수 있습니까?

+0

cvflann::FLANN_DIST_EUCLIDEAN 같은 다른 사람들이 당신으로 같은 문제를 얻을 수도있다 : 나는 내 여분의 매개 변수와 함께 작동, 내가 같은 오류가 있다고 생각? 지원되지 않는 형식 또는 형식 조합 (type = 0 ), buildIndex_, 파일 /Users/alexandershishkov/Downloads/opencv-2.4.8/modules/flann/src/miniflann.cpp, 315 행 – Jing

+0

벡터는 반드시 바이너리 여야합니까? – mrgloom

답변

0

시도해보십시오. 당신이 솔루션을 가지고, cvflann에서

cv::flann::Index kVecinos(descriptors, cv::flann::LshIndexParams(12, 20, 2), cvflann::FLANN_DIST_HAMMING); 

관련 문제