c++ - How To Import External Library to OpenCV -


i extract features of images using opencv 3.0 visual studio 2013.

my code:

#include <stdio.h> #include <iostream> #include "opencv2\core.hpp" #include "opencv2\features2d.hpp" #include <opencv2\xfeatures2d.hpp> #include <opencv2\highgui.hpp>  using namespace cv; using namespace cv::xfeatures2d;  void readme();  /** @function main */ int main(int argc, char** argv) {     if (argc != 3)     {         readme(); return -1;     }      mat img_1 = imread(argv[1], imread_grayscale);     mat img_2 = imread(argv[2], imread_grayscale);      if (!img_1.data || !img_2.data)     {         std::cout << " --(!) error reading images " << std::endl; return -1;     }      //-- step 1: detect keypoints using surf detector     int minhessian = 400;      ptr<surf> detector = surf::create(minhessian);      std::vector<keypoint> keypoints_1, keypoints_2;      detector->detect(img_1, keypoints_1);     detector->detect(img_2, keypoints_2);      //-- draw keypoints     mat img_keypoints_1; mat img_keypoints_2;      drawkeypoints(img_1, keypoints_1, img_keypoints_1, scalar::all(-1), drawmatchesflags::default);     drawkeypoints(img_2, keypoints_2, img_keypoints_2, scalar::all(-1), drawmatchesflags::default);      //-- show detected (drawn) keypoints     imshow("keypoints 1", img_keypoints_1);     imshow("keypoints 2", img_keypoints_2);      waitkey(0);      return 0; }  /** @function readme */ void readme() {     std::cout << " usage: ./surf_detector <img1> <img2>" << std::endl; } 

error:

cannot open include file: 'opencv2\xfeatures2d.hpp': no such file or directory   

in c:\opencv3.0.0\opencv\build\include\opencv2

directory, there no xfeatures2d.hpp file. thus, should import library externally. how fix it?


Comments