我一直在使用 OpenCV 3.0,它与使用 CMake 3.5 的额外模块相结合。我使用 Visual Studio 2012 32 位作为我的 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
}
我试过其他 header ,例如 tracking.hpp。我能够定义:
Ptr<Tracker> tkr;
没有 Tracker 给我错误。
有人知道错误是在 CMake 过程中引起的还是我遗漏了什么?
最佳答案
我刚遇到同样的问题,偶然发现了你的问题。
我刚刚找到的答案是你必须添加,
using namespace line_descriptor;
在顶部以及 cv 命名空间。从 line_descriptor.hpp 源代码中获得此提示。
关于c++ - 包含 line_descriptor.hpp,但 KeyLine 和 BinaryDescriptor 仍未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35971749/