【问题标题】:Opencv 3.0 features2d.hpp error : unknown AlgorithmInfoOpencv 3.0 features2d.hpp 错误:未知 AlgorithmInfo
【发布时间】:2016-01-08 03:07:43
【问题描述】:

我正在使用 opencv3.0 开发一个项目,该项目带有在 opencv_contrib github 中找到的额外模块。我使用 Xcode 7.0,优胜美地 10.10。 我已经在 Xcode 中完成了设置

标题搜索路径: /Users/kimloonghew/Documents/opencv/opencv-3.0.0/build/include /usr/local/Cellar/libiomp/20150401/include/libiomp/omp.h /usr/local/include

图书馆搜索路径: /Users/kimloonghew/Documents/opencv/opencv-3.0.0/build/lib /usr/local/lib

其他链接标记:-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 P >

下面是代码:

#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;
}

当我运行该文件时,它 BUILD 失败,并出现在 featuares2d.hpp 文件中检测到的错误。错误如下 1) 未知类型名称'AlgorigthmInfo';你的意思是“算法”吗? 2) 没有名为“vector”的模板;你的意思是“std::vector”吗?

设置或安装 opencv 时我做错了什么?或者我必须定义的任何链接路径? 赞赏,为您的建议。谢谢

【问题讨论】:

    标签: c++ xcode7 opencv3.0


    【解决方案1】:

    已解决的问题:

    Xcode 编译器很智能,它能够预测与您当前机器配置相匹配的解决方案。如果你只是按照 Xcode 编译器给出的建议,问题就解决了。

    系统无法识别AlgorigthmInfo,您可以更改为Algorigthm 以及将vector 更改为std::vector

    现在 openCV 在我的机器上运行良好。

    希望,如果遇到同样的问题,这将对其他人有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-03-05
      • 1970-01-01
      • 2014-11-10
      • 2015-08-07
      • 2016-12-26
      • 2016-03-29
      • 2016-06-12
      • 2023-03-13
      相关资源
      最近更新 更多