包含line_descriptor.hpp,但KeyLine和BinaryDescriptor仍未定义
line_descriptor.hpp is included, but KeyLine and also BinaryDescriptor are still undefined
我一直在使用OpenCV 3.0,它与使用CMake 3.5的额外模块相结合。我正在使用Visual Studio 2012 32bit作为我的IDE。
但是,我似乎不能同时使用KeyLine和BinaryDescriptor。他们给我的错误是"标识符KeyLine未定义"。我已经设置了路径和库设置。
#include <opencv2/opencv.hpp>
#include <opencv2/line_descriptor.hpp>
#include <iostream>
using namespace std;
using namespace cv;
int main( void ) {
Ptr<BinaryDescriptor> bd = BinaryDescriptor::createBinaryDescriptor();// this line gives error
vector<KeyLine> lines; // same as this
}
我已经尝试了另一个标题,例如tracking.hpp。我能够定义:
Ptr<Tracker> tkr;
没有跟踪器给我错误。
有谁知道错误是在CMake过程中引起的还是我错过了什么?
我刚刚遇到了同样的问题,偶然发现了你的问题。
我刚刚发现的答案是你必须添加,
using namespace line_descriptor;
在顶部与 CV 命名空间一起。从 line_descriptor.hpp 源代码中得到了这个提示。