Ask Your Question
0

sift and surf in opencv 3.2

asked 2017-01-23 05:04:18 -0600

muc gravatar image

Hi, i build opencv 3.2 with opencv-contrib moduls also add [ #include "opencv2/xfeatures2d.hpp"] and [using namespace cv::xfeatures2d;] to my code but i have error when compile it. i used these commands for surf:

    Ptr<SURF> detector; 
detector->create();
     detector->detect( imgbackground, Keypoints1 );

please guide me. thanks,

edit retag flag offensive close merge delete

Comments

Please post the error message

renV gravatar imagerenV ( 2017-01-23 05:24:56 -0600 )edit

Hi, the error is: error LNK2019: unresolved external symbol "public: static struct cv::Ptr<class cv::xfeatures2d::surf=""> __cdecl cv::xfeatures2d::SURF::create(double,int,int,bool,bool)" (?create@SURF@xfeatures2d@cv@@SA?AU?$Ptr@VSURF@xfeatures2d@cv@@@3@NHH_N0@Z) referenced in function "void __cdecl campring(class cv::Mat const &,class cv::Mat const &)" (?campring@@YAXABVMat@cv@@0@Z)

muc gravatar imagemuc ( 2017-01-23 06:11:02 -0600 )edit

it seems like linker error. which version of visual studio you use ?

renV gravatar imagerenV ( 2017-01-23 06:22:26 -0600 )edit

if i only remove SURF process from my code , the compiler does not take error. then version of visual studio is ok. for example i detect background too .

muc gravatar imagemuc ( 2017-01-23 06:38:10 -0600 )edit

is it in release mode ?

renV gravatar imagerenV ( 2017-01-23 07:03:47 -0600 )edit

in debug mode.

muc gravatar imagemuc ( 2017-01-23 07:07:47 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-01-23 05:29:21 -0600

berak gravatar image

updated 2017-01-23 06:48:00 -0600

the create method is static, you have to use it like:

 Ptr<SURF> detector = SURF::create();

also, you have to link to opencv_xfeatures2d320.lib

edit flag offensive delete link more

Comments

i used this command but the compiler take error.

muc gravatar imagemuc ( 2017-01-23 06:12:19 -0600 )edit

no, your linker throws an error. (please try to understand the difference)

berak gravatar imageberak ( 2017-01-23 06:49:33 -0600 )edit

ok i do not have opencv_xfeatures2d320.lib in build . which module in opencv_contrib is for "xfeatures2d.lib"

muc gravatar imagemuc ( 2017-01-23 06:59:48 -0600 )edit

i rerun cmake and saw when build , this error appear "modules\xfeatures2d\src\boostdesc.cpp(244): error C3861: 'round': identifier not found" how solved it

muc gravatar imagemuc ( 2017-01-23 07:52:06 -0600 )edit

replace with cvRound (and rebuild)

berak gravatar imageberak ( 2017-01-23 08:00:16 -0600 )edit

thanks a lot .. every thing is ok, i saw other error Of course, I did not need to these modules: 1_LINK : fatal error LNK1104: cannot open file '....\lib\Debug\opencv_dnn320d.lib'

2_LINK : fatal error LNK1104: cannot open file '....\lib\Debug\opencv_ximgproc320d.lib'

3_LINK : fatal error LNK1104: cannot open file '....\lib\Debug\opencv_tracking320d.lib'

4_>......\modules\ximgproc\src\fast_line_detector.cpp(185): error C3861: 'round': identifier not found

thanks

muc gravatar imagemuc ( 2017-01-23 09:11:54 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-01-23 05:04:18 -0600

Seen: 3,507 times

Last updated: Jan 23 '17