int match(int page,Mat img_frame){
Mat des_frame;
std::vector<KeyPoint> kp_frame;
std::vector<vector<DMatch > > matches;
detector.detect( img_frame, kp_frame );
extractor.compute(img_frame,kp_frame,des_frame);
std::vector<DMatch > good_matches;
if(page<0)
return 0;
switch(pageNumber)
{
case 0:
matcher.knnMatch(des_page[0], des_frame, matches, 2);
break;
case 2:
matcher.knnMatch(des_page[1], des_frame, matches, 2);
//cout<<"matcigpage23";
break;
case 4:
matcher.knnMatch(des_page[2], des_frame, matches, 2);
break;
case 6:
matcher.knnMatch(des_page[3], des_frame, matches, 2);
break;
case 8:
matcher.knnMatch(des_page[4], des_frame, matches, 2);
break;
case 10:
matcher.knnMatch(des_page[5], des_frame, matches, 2);
break;
}
for(int i = 0; i < min(des_frame.rows-1,(int) matches.size()); i++) //THIS LOOP IS SENSITIVE TO SEGFAULTS
{
if((matches[i][0].distance < 0.6*(matches[i][1].distance)) && ((int) matches[i].size()<=2 && (int) matches[i].size()>0))
{
good_matches.push_back(matches[i][0]);
}
}
return good_matches.size();
}
我的“.cpp”中有这样的功能。当我在 Visual Studio 2010 中编译它时,我收到如下链接器错误:
1>realtime.obj:错误 LNK2019:引用了未解析的外部符号“public:__thiscall cv::SIFT::SIFT(int,int,double,double,double)”(??0SIFT@cv@@QAE@HHNNN@Z)在函数“void _ cdecl 'detector''(void) 的动态初始化程序”中 (?? _Edetector@@YAXXZ)
1>realtime.obj:错误 LNK2019:未解析的外部符号“公共:__thiscall cv::flann::KDTreeIndexParams::KDTreeIndexParams(int)”(??0KDTreeIndexParams@flann@cv@@QAE@H@Z) 在函数中引用“ void _ cdecl 'matcher'的动态初始化器'(void)" (?? _Ematcher@@YAXXZ)
1>realtime.obj:错误 LNK2019:未解析的外部符号“公共:__thiscall cv::flann::SearchParams::SearchParams(int,float,bool)”(??0SearchParams@flann@cv@@QAE@HM_N@Z)在函数“void _ cdecl 'matcher'(void) 的动态初始化程序”中引用 (?? _Ematcher@@YAXXZ)
1>realtime.obj:错误 LNK2019:未解析的外部符号“public:__thiscall cv::flann::IndexParams::~IndexParams(void)”(??1IndexParams@flann@cv@@QAE@XZ) 在函数“public”中引用: void * __thiscall cv::flann::IndexParams::`标量删除析构函数'(unsigned int)" (??_GIndexParams@flann@cv@@QAEPAXI@Z)
1>C:\Users\vinit\documents\visual studio 2010\Projects\mynewopencv\Debug\mynewopencv.exe : 致命错误 LNK1120: 4 unresolved externals
我是新的 Visual Studio,我将非常感谢一些帮助。