Reputation: 1081
I'm developing a project using opencv3.0 with extra module found in opencv_contrib github. Im using Xcode 7.0, Yosemite 10.10. I have done the setting in Xcode
Header Search path : /Users/kimloonghew/Documents/opencv/opencv-3.0.0/build/include /usr/local/Cellar/libiomp/20150401/include/libiomp/omp.h /usr/local/include
Library Search path : /Users/kimloonghew/Documents/opencv/opencv-3.0.0/build/lib /usr/local/lib
Other Linker Flag : -lopencv_calib3d -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_highgui -lopencv_imgcodecs -lopencv_imgproc -lopencv_ml -lopencv_objdetect -lopencv_photo -lopencv_shape -lopencv_stitching -lopencv_superres -lopencv_ts -lopencv_video -lopencv_videoio -lopencv_videostab -lopencv_nonfree -lopencv_ml -lopencv_xfeatures2d
Here the code below:
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <dirent.h>
#include <string>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <opencv2/core.hpp>
#include <opencv2/opencv.hpp>
#include <opencv2/features2d/features2d.hpp>
#include <opencv2/nonfree/nonfree.hpp>
#include <opencv2/xfeatures2d.hpp>
#include <opencv2/nonfree/features2d.hpp>
#include <opencv2/ml/ml.hpp>
using namespace std;
using namespace cv;
int main(int argc, const char * argv[]) {
int minHessin = 400;
string dir = "/Users/DYKLhew/Documents/Food_proj/MIT/foodcamimages/TRAIN", filepath;
DIR *dp;
struct dirent *dirp;
struct stat filestat;
dp = opendir(dir.c_str());
SurfFeatureDetector detector(minHessin);
//Ptr<xfeatures2d::SURF> detector = xfeatures2d::SURF::create(minHessin);
vector<KeyPoint> keypoints, keypoints_scene;
Mat descriptors_object, descriptor_scene;
Mat img;
cout << "------- build vocabulary ---------\n";
cout << "extract descriptors.."<<endl;
int count = 0;
while (count++ < 15 && (dirp = readdir(dp))) {
filepath = dir + "/" + dirp->d_name;
if(stat( filepath.c_str(), &filestat )) continue;
if(S_ISDIR(filestat.st_mode)) continue;
img = imread(filepath);
detector.detect(img, keypoints);
cout << ".";
}
cout << endl;
closedir(dp);
cout << "Total descriptors : " << count << endl;
//BOWKMeansTrainer bowtrainer(150);
return 0;
}
When I run the file, it BUILD fail with the errors detected in featuares2d.hpp files. Errors as below 1) Unknown type name 'AlgorigthmInfo'; did you mean 'Algorigthm'? 2) No template named 'vector'; did you mean 'std::vector?'
Anything i did wrong when setup or installing opencv? or any linkpath i have to define? Appreciated, for your advice. Thanks
Upvotes: 2
Views: 2408
Reputation: 1081
Issues Solved:
Xcode compiler is smart and it able to predict solutions it match to your current machine configuration. If you just follow the suggestion given from the Xcode compiler, the issues was solve.
System not recognise AlgorigthmInfo
, you may change to Algorigthm
as well as vector
to std::vector
.
Now is completely working well openCV in my machine.
Hope, this will help some others if facing same issues.
Upvotes: 1