编译opencv4.0.x版本的程序时,因为我的疏忽导致opencv 函数参数顺序调用错误,可是编译时没有提示该语句参数顺序错误,提示如下错误:函数
g:\library\opencv-master\build\install\include\opencv2\core\traits.hpp(386): error C2039: “type”: 不是“cv::DataType<T>”的成员 1> with 1> [ 1> T=cv::KeyPoint 1> ] 1> g:\library\opencv-master\build\install\include\opencv2\core\traits.hpp(386): note: 参见“cv::DataType<T>”的声明 1> with 1> [ 1> T=cv::KeyPoint 1> ] 1> g:\library\opencv-master\build\install\include\opencv2\core\mat.inl.hpp(95): note: 参见对正在编译的类 模板 实例化“cv::traits::Type<_Tp>”的引用 1> with 1> [ 1> _Tp=cv::KeyPoint 1> ] 1> g:\project\rewptis\rewptis\rewptis.cpp(192): note: 参见对正在编译的函数 模板 实例化“cv::debug_build_guard::_InputArray::_InputArray<cv::KeyPoint>(const std::vector<cv::KeyPoint,std::allocator<_Ty>> &)”的引用 1> with 1> [ 1> _Ty=cv::KeyPoint 1> ] 1>g:\library\opencv-master\build\install\include\opencv2\core\traits.hpp(386): error C2065: “type”: 未声明的标识符
解决办法:ui
这种没法定位到指定代码的错误,须要对代码进行分段注释,查找出错代码段,而后仔细校验函数参数便可;debug
个人出错函数为:code
cv::drawMatches(imageList[edge.first].getMat(cv::ACCESS_READ), imageList[edge.second].getMat(cv::ACCESS_READ), keypoints[edge.first], keypoints[edge.second], matches[i], img_matches);
正确的为:blog
cv::drawMatches(imageList[edge.first].getMat(cv::ACCESS_READ), keypoints[edge.first], imageList[edge.second].getMat(cv::ACCESS_READ), keypoints[edge.second], matches[i], img_matches);