Mr_yy
2016-07-16 12:58
采纳率: 50%
浏览 2.7k
已采纳

ubuntu下使用findChessboardCorners(opencv)出错

想用qt编写个能显示棋盘角点的程序,但是一直提示 undefined reference to `cv::findChessboardCorners‘,
想不通为什么?具体代码如下
主要代码如下

 cv::Mat image1, Extractcorner;
    std::vector<cv::Point2f> corners;    //用来储存所有角点坐标
    cv::Size board_size = cv::Size(6, 7);   //标定板每行,每列角点数
    image1 = cv::imread("0.jpg");
    Extractcorner = image1.clone();

    cv::Mat imageGray;
    cv::cvtColor(image1, imageGray, CV_RGB2GRAY);
    bool patternfound = cv::findChessboardCorners(image1, board_size, corners);
    if (!patternfound)
    {
        std::cout << "can not find chessboard corners!" << std::endl;
        exit(1);
    }
    else
    {
        //亚像素精确化
        cv::cornerSubPix(imageGray, corners, cv::Size(11, 11), cv::Size(-1, -1), cv::TermCriteria(CV_TERMCRIT_EPS + CV_TERMCRIT_ITER, 30, 0.1));
    }

头文件:

 #include <QMainWindow>
#include<cv.h>
#include <highgui.h>
#include<cxcore.h>
#include <QTimer>
#include <QPainter>
#include<vector>
#include<math.h>
#include<opencv2/opencv.hpp>

在qt工程.pro也添加了链接库

 INCLUDEPATH += /usr/local/include \
                /usr/local/include/opencv \
                /usr/local/include/opencv2
LIBS += /usr/local/lib/libopencv_highgui.so \
        /usr/local/lib/libopencv_core.so    \
        /usr/local/lib/libopencv_imgproc.so

然后提示
undefined reference to `cv::findChessboardCorners(cv::_InputArray const&, cv::Size_, cv::_OutputArray const&, int)'
求大神帮忙回答下啊?很急!!

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • Valtava 2016-07-16 18:25
    已采纳

    findChessboardCorners 是不是calib3d里的? 你库没包含

    已采纳该答案
    打赏 评论

相关推荐 更多相似问题