包括calib3d会产生许多编译错误

时间:2016-05-09 08:02:07

标签: c++ opencv

我正在尝试使用cv::Rodrigues函数来从给定的角度向量中获取旋转矩阵。

我的程序中已包含这些内容:

#include "opencv2/video/tracking.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/videoio/videoio.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/core.hpp"

如果不添加#include "opencv2/calib3d.hpp",一切都可以正常编译。 但是当我添加它以便能够使用cv::Rodrigues时,编译失败并出现许多错误。

我不会添加整个错误日志,因为它会很长且没用。但它从这开始:

<command-line>:0:9: error: expected identifier before numeric constant
<command-line>:0:9: error: expected '}' before numeric constant
<command-line>:0:9: error: expected unqualified-id before numeric constant

之后我有很多错误,例如:

/usr/local/include/opencv2/features2d.hpp:1106:69: error: expected primary-expression before 'int'
                                const Scalar& color=Scalar::all(-1), int flags=DrawMatchesFlags::DEFAULT );
                                                                     ^
/usr/local/include/opencv2/features2d.hpp:1130:32: error: variable or field 'drawMatches' declared void
 CV_EXPORTS_W void drawMatches( InputArray img1, const std::vector<KeyPoint>& keypoints1,
                                ^
/usr/local/include/opencv2/features2d.hpp:1130:32: error: 'InputArray' was not declared in this scope

为了完整性,这里是我要添加的代码的一部分:

void test(cv::Matx33f& rot_mat){

    float x =  50 * (M_PI/180);
    float y =  -10 * (M_PI/180);
    float z =  0 * (M_PI/180);

    cv::Matx31f rot_vec(x,y,z);

    //converts to a rotation matrix
    cv::Rodrigues(rot_vec, rot_mat);
}

注意:我正在使用OpenCV 3.1.0开发Ubuntu 15.10并且我确实在我的makefile中添加了-lopencv_calib3d

0 个答案:

没有答案