Can't find xfeatures2d.hpp

asked 2015-03-12 14:42:41 -0600

Yamin gravatar image

updated 2015-03-12 14:58:40 -0600

theodore gravatar image

When installing opencv 3.0 and opencv_contrib, i just follow the tutorial using linux command and get the source code from github. Both are installed successfully, but when i write:

#include "opencv2/xfeatures2d"

It turns out opencv can not find the file. When I refer to the path usr/local/include/, I can not find this file myself too. Since everything complied successfully, I dont know what is wrong with this file.

edit retag flag offensive close merge delete

Comments

did you run a final make install ?

berak gravatar imageberak ( 2015-03-12 15:02:14 -0600 )edit

What command are you using to compile?

Potato gravatar imagePotato ( 2015-03-12 15:25:00 -0600 )edit

also try #include <opencv2/xfeatures2d.hpp>

Guanta gravatar imageGuanta ( 2015-03-13 04:19:52 -0600 )edit

Maby You haven't installed opencv properly. Haave You specified path to contrib module before runing cmake? (do as they write in readme me).

In my programs I include the fallowing from opencv :

#include "opencv2/core.hpp"
#include "opencv2/features2d.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/xfeatures2d.hpp"
#include <opencv2/calib3d/calib3d.hpp>
Wilk gravatar imageWilk ( 2015-03-17 10:28:27 -0600 )edit

Seems like a similar problem I am stuck with.

I installed the opencv_contrib using cmake-gui(WINDOWS 8) and i am having the same problem(I cannot include any of these new files )... I checked the "opencv\build\include" folder there is a new CMakeFIles directory but no recently modified file in the "opencv" or "opencv2" directory...

Most probably I am getting this problem because of the following reason: I could't understand the 7th step of the readme --> build the opencv core with the method you chose (make and make install if you chose Unix makfile at step 6)

Please can anyone explain this step?

Bhatt gravatar imageBhatt ( 2015-06-26 13:51:54 -0600 )edit

@Bhatt, on win, you will have to build the INSTALL project. this will copy headers/libs/dlls to your install folder

berak gravatar imageberak ( 2015-06-27 03:18:32 -0600 )edit

@Wilk, Thank you... that did the thing.....

Bhatt gravatar imageBhatt ( 2015-06-28 14:01:21 -0600 )edit

Have the same problem, please can you explain what "you will have to build the INSTALL project" exactly means?

Powernow gravatar imagePowernow ( 2018-08-30 01:13:29 -0600 )edit

cmake generated an opencv.sln , which contains an INSTALL project, and you need to build this (from visualstudio)

berak gravatar imageberak ( 2018-08-30 01:28:07 -0600 )edit

@Bhatt: Thxs for fast response! Do you know what to do if I compiled opencv+contrib with mingw530 from qt?

Powernow gravatar imagePowernow ( 2018-08-30 03:03:02 -0600 )edit

@Powernow , far too unspecific. please ask a new question, containing your details !

berak gravatar imageberak ( 2018-08-30 04:15:54 -0600 )edit

I used Win10, mingw530 (Qt), opencv-3.4.2, opencv_contrib-3.4.2, mingw32-make, mingw32-make install.

Filestructur:

opencv/source

opencv/build

opencv/release (compile folder)

opencv/opencv_contrib-3.4.2 (OPENCV_EXTRA_MODULS_PATH, set OPENCV_ENABLE_NONFREE)

But if I try to insert in my example

\#include "opencv2/xfeatures2d.hpp"

it does not find it.

My fallback for SIFT, SURF is to insert.

\#include "E:/PROGRAMS/opencv/opencv_contrib-3.4.2/modules/xfeatures2d/include/opencv2/xfeatures2d/nonfree.hpp"

if I insert

"E:\PROGRAMS\opencv\opencv_contrib-3.4.2\modules\xfeatures2d\include\opencv2\xfeatures2d.hpp:43: error: opencv2/xfeatures2d/nonfree.hpp: No such file or directory"
Powernow gravatar imagePowernow ( 2018-08-30 05:32:25 -0600 )edit

no, you have to add E:/PROGRAMS/opencv/build/install/include to the "Additional include paths" in VS.

berak gravatar imageberak ( 2018-08-30 05:46:52 -0600 )edit

Qt does not accept #include <opencv2/xfeatures2d.hpp>. The reason is I have no E:/PROGRAMS/opencv/build/install directory. This is the problem.

If have in my release folder E:\PROGRAMS\opencv\release\install\include\opencv2\xfeatures2d.hpp

Powernow gravatar imagePowernow ( 2018-08-30 06:05:34 -0600 )edit