Opencv 3.0 features2d.hpp错误:未知的AlgorithmInfo
Opencv 3.0 features2d.hpp error : unknown AlgorithmInfo
我正在使用opencv3.0开发一个项目,该项目在opencv_contrib github中有额外的模块。我使用的是Xcode 7.0,Yosemite 10.10。我已经在Xcode 中完成了设置
标题搜索路径:/用户/kimloonghew/Documents/opencv/opencv-3.0.0/build/include/usr/local/Cellar/libiomp/20150401/include/libiomp/omp.h/usr/local/include
库搜索路径:/用户/kimloonghew/Documents/occv/opencv-3.0.0/build/lib/usr/local/lib
其他链接器标志:-lopencv_calib3d-lopencv_core-lopenc_features2d-lopencv_frann-lopenv_higgui-lopenc v_imgcodecs-lopency v_imgproc-lopench v_ml-lopencov_objectdetect-loperc v_photo-lopecci v_shape-lopecc v_setting-lopecf v_superes-lopecn v_ts-loppencv_video-lopcv_videostab-lopercv_nofree-lopecl v_vxfeatures2d
这里的代码如下:
#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( 未知类型名称"AlgorithmInfo";你是说"算法"吗?2( 没有名为"vector"的模板;你是说"std::vector"吗
我在设置或安装opencv时做错了什么?或者我必须定义的任何链接路径?非常感谢你的建议。感谢
解决的问题:
Xcode编译器是智能的,它能够预测与您当前机器配置匹配的解决方案。如果您只是遵循Xcode编译器给出的建议,问题就解决了。
系统无法识别AlgorigthmInfo
,您可以将其更改为Algorigthm
,也可以将vector
更改为std::vector
。
现在在我的机器中openCV完全工作良好。
希望,如果面临同样的问题,这将帮助其他一些人。
- 继承期间显示未知行为的子类
- 输入中的字符串数未知(以字母表示)
- 具有未知值时的时间复杂性
- 链表中写入访问冲突的未知原因
- 正在生成未知类实例
- Bjarne Stroustrup Book - std_lib_facilities.h - 不起作用(未知类型名称)
- 读取文件时运行时的未知行为
- 代码在我的计算机上运行良好,但是在将其提交给coursera时遇到未知的信号11问题
- 初始化多个未知基类
- 使用 make 编译 MPI,几个命名空间错误,例如"错误:未知类型名称'使用'?
- 如何存储未知次数迭代的输入?
- QtQuick - qml:28:错误:未知方法返回类型:自定义类型
- 编译 Boost 时在 OS X 上的"ld:未知选项:-soname"
- 未知的 CMake 命令"create_single_source_cgal_program"
- 如何在C++中循环访问未知对象方法?
- Coursera :自动评分器的未知信号 11
- 即使直接从官方示例中复制,也找不到未知类型名称QML_ELEMENT和 QML 模块
- 未知的 GCC 链接器错误,但已成功构建
- 如何从未知视图中声明范围::v3::View 变量
- Opencv 3.0 features2d.hpp错误:未知的AlgorithmInfo