将特征库与OpenCV 2.3.1
Using Eigen Library with OpenCV 2.3.1
我在C++中使用Eigen3库和OpenCV应用程序时遇到问题。我使用以下命令在Ubuntu上安装了Eigen3库:
sudo apt-get install libeigen3-dev
当我使用以下命令进行编译时,我能够编译并使用示例Eigen3应用程序(安装了Eigen3库,它可以工作)。
g++ -I/usr/include/eigen3 Eig.cpp -o Eig
我想将已安装的Eigen库与OpenCV一起使用。
我用以下标志编译了OpenCV源代码:
cmake -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=OFF -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON USE_EIGEN=/usr/include/eigen3 ..
我的OpenCV代码包括以下标题和名称空间:
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <assert.h>
#include <opencv2/core/eigen.hpp>
using namespace cv;
using namespace std;
using namespace Eigen;
但是,当我正常编译OpenCV应用程序时,我的编译器会给我以下错误:
In file included from Read.cpp:6:
/usr/local/include/opencv2/core/eigen.hpp:54: error: expected ‘,’ or ‘...’ before ‘::’ token
/usr/local/include/opencv2/core/eigen.hpp: In function ‘void cv::eigen2cv(int)’:
/usr/local/include/opencv2/core/eigen.hpp:56: error: ‘src’ was not declared in this scope
/usr/local/include/opencv2/core/eigen.hpp:56: error: ‘Eigen’ is not a class or namespace
/usr/local/include/opencv2/core/eigen.hpp:60: error: ‘dst’ was not declared in this scope
/usr/local/include/opencv2/core/eigen.hpp:66: error: ‘dst’ was not declared in this scope
我该如何解决这个问题?
我只需要包括
#include <Eigen/Dense>
在包括OpenCV标题之前,仅此而已。我通过包含Eigen lib标头和OpenCV lib标头来编译它们。
首先,我要仔细检查是否找到了特征包含方向。您可以使用CMakeList.txt来完成此操作(并且您应该使用cmake函数来查找标头并链接到库,而不是编译器标志)
接下来,您可以尝试删除使用名称空间
using namespace cv;
using namespace std;
using namespace Eigen;
相关文章:
- 在C++中使用OpenCV矩阵中的特征将图像旋转90度
- OpenCV特征匹配并行处理
- 将元素从opencv矩阵复制到特征矩阵
- 在不使用经过训练的模型的情况下检测/分割面部和面部特征:openCV C++
- 如何通过opencv中的程序参数定义特征类型?
- 从特征匹配/单应性中过滤掉误报 – OpenCV
- 将 BGR OpenCV 垫映射到特征张量
- OPENCV:如何使用5点算法从来自不同相机的两个图像之间的特征匹配来计算必需矩阵
- 使用OpenCV Cuda ORB特征检测器
- 在矢量中使用值(特征)来计算OpenCV的余弦相似性
- 识别多个面(特征面opencv)
- 如何确定使用 vlfeat 和 opencv C++的图像的 PHOW 特征
- 使用 Opencv 计算 haar 特征
- Opencv C++读取分配给特征向量的Opencv Mat
- 如何从opencv cv::Mat或行主数组初始化特征矩阵
- OpenCV 标签连接和计算图像区域的特征测量值
- 在 OpenCV 中执行特征面算法时出错
- OpenCV:带有CSV文件的特征面
- 如何使用 opencv c++ 从手部轮廓中提取 LBP 特征
- C++ - 使用 ORB 进行 OpenCV 特征检测