OpenCV(C ++ / Qt) - cornerSubPix错误 [英] OpenCV (C++/Qt) - cornerSubPix error

查看:1427
本文介绍了OpenCV(C ++ / Qt) - cornerSubPix错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好!



我从imgproc.hpp文件中遇到了cornerSubPix方法的问题。
我不明白哪个库缺少或什么是错误。
我在OS X 10.10.3上使用Qt 5.4.1,并使用OpenCV 3.0.0 C ++库。



这是我的代码:

  #include< Opencv2 / opencv.hpp> 
#include< opencv2 / core / types.hpp>
#include< opencv2 / highgui / highgui.hpp>
#include< opencv2 / imgproc.hpp>
#include< opencv2 / features2d / features2d.hpp>
#include< vector>
#include< stdio.h>
#includecameraparams.h
#include< iostream>

[...]

矢量< vector< Point2f> > left_2D_points,right_2D_points;

for(int i = 0; i< left_images.size(); i ++){

Mat left_image = left_images [i];
Mat rig

ht_image = right_images [i];
std :: vector< cv :: Point2f> left_im_points,right_im_points;

bool found_left = findChessboardCorners(left_image,Size(width,height),left_im_points,CALIB_CB_ADAPTIVE_THRESH + CALIB_CB_NORMALIZE_IMAGE + CALIB_CB_FAST_CHECK);
bool found_right = findChessboardCorners(right_image,Size(width,height),right_im_points,CALIB_CB_ADAPTIVE_THRESH + CALIB_CB_NORMALIZE_IMAGE + CALIB_CB_FAST_CHECK);

if(found_left& found_right){
Size winSize = Size(7,7);
Size zeroZone = Size(-1,-1);
TermCriteria criteria = TermCriteria(TermCriteria :: EPS + TermCriteria :: MAX_ITER,40,0.001);

cv :: cornerSubPix(left_image,left_im_points,winSize,zeroZone,criteria);

}

}

我的* .pro文件:

  INCLUDEPATH + = / usr / local / include / \ 
/ usr / local /include/pcl-1.7/ \
/ usr / local / include / eigen3 / \
/usr/local/include/vtk-6.2/

LIBS + = -L / usr / local / lib \
-lopencv_core \
-lopencv_imgcodecs \
-lopencv_highgui \
-lopencv_imgproc \
-lopencv_objdetect \
-lopencv_calib3d \
-lopencv_features2d \
-lopencv_flann \
-lopencv_ml \
-lopencv_photo \
-lopencv_shape \
-lopencv_stitching \
-lopencv_superres \
-lopencv_ts \
-lopencv_video \
-lopencv_videoio \
-lopencv_videostab

所以我想在我的棋盘上更精确地检测角。但是当我编译时,我得到这个错误:

 架构x86_64的未定义符号:
cv :: _ InputArray :: getMatVector(std :: vector< cv :: Mat,std :: allocator< cv :: Mat>>&)const,引用自:
vtable for cv :: _ InputOutputArray in calibrator.o
cv :: _ InputArray :: getUMatVector(std :: vector< cv :: UMat,std :: allocator< cv :: UMat>&)const,引用自:
vtable for cv :: _ InputOutputArray in calibrator.o
ld:没有为架构x86_64找到符号
clang:error:linker命令失败,退出代码为1(使用-v查看调用)
make :*** [Classification]错误1

我现在正在寻找答案,我已经被封锁了。

解决方案

这个问题是第一个此处报告。它似乎与您的编译器使用的C ++标准库的版本相关。

Stackoverflow的另一个答案似乎解决了这个问题。



Google是您的朋友。


Hello !

I'm having troubles with cornerSubPix method from imgproc.hpp file. I don't understand which library is missing or what's the error. I work with Qt 5.4.1 on OS X 10.10.3, and using OpenCV 3.0.0 C++ library.

Here is my code :

    #include <opencv2/opencv.hpp>
    #include <opencv2/core/types.hpp>
    #include <opencv2/highgui/highgui.hpp>
    #include <opencv2/imgproc.hpp>
    #include <opencv2/features2d/features2d.hpp>
    #include <vector>
    #include <stdio.h>
    #include "cameraparams.h"
    #include <iostream>

    [...]

    vector< vector <Point2f> > left_2D_points, right_2D_points;

        for( int i=0;i<left_images.size();i++){

            Mat left_image = left_images[i];
            Mat rig

ht_image = right_images[i];
        std::vector<cv::Point2f> left_im_points,right_im_points;

        bool found_left = findChessboardCorners(left_image,Size(width,height),left_im_points,CALIB_CB_ADAPTIVE_THRESH + CALIB_CB_NORMALIZE_IMAGE+ CALIB_CB_FAST_CHECK);
        bool found_right = findChessboardCorners(right_image,Size(width,height),right_im_points,CALIB_CB_ADAPTIVE_THRESH + CALIB_CB_NORMALIZE_IMAGE+ CALIB_CB_FAST_CHECK);

        if( found_left && found_right){
              Size winSize = Size( 7, 7 );
              Size zeroZone = Size( -1, -1 );
              TermCriteria criteria = TermCriteria( TermCriteria::EPS + TermCriteria::MAX_ITER, 40, 0.001 );

              cv::cornerSubPix(left_image,left_im_points,winSize,zeroZone,criteria);

        }

    }

And here is my *.pro file :

INCLUDEPATH +=  /usr/local/include/ \
                /usr/local/include/pcl-1.7/ \
                /usr/local/include/eigen3/ \
                /usr/local/include/vtk-6.2/

LIBS += -L/usr/local/lib \
        -lopencv_core \
        -lopencv_imgcodecs \
        -lopencv_highgui \
        -lopencv_imgproc \
        -lopencv_objdetect \
        -lopencv_calib3d \
        -lopencv_features2d \
        -lopencv_flann \
        -lopencv_ml \
        -lopencv_photo \
        -lopencv_shape \
        -lopencv_stitching \
        -lopencv_superres \
        -lopencv_ts \
        -lopencv_video \
        -lopencv_videoio \
        -lopencv_videostab

So I want to detect corner more precisely on my checkerboard. But when I'm compiling I get this error :

Undefined symbols for architecture x86_64:
  "cv::_InputArray::getMatVector(std::vector<cv::Mat, std::allocator<cv::Mat> >&) const", referenced from:
      vtable for cv::_InputOutputArray in calibrator.o
  "cv::_InputArray::getUMatVector(std::vector<cv::UMat, std::allocator<cv::UMat> >&) const", referenced from:
      vtable for cv::_InputOutputArray in calibrator.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Classification] Error 1

I am looking for the answer since several days now, and I'm already blocked. Thank you all in advance for any trail !

解决方案

This issue was first reported here. It appears to be related to the version of the C++ standard library that your compiler is using. A few workarounds have been discussed on that thread.

However, another answer on Stackoverflow seems to fix the problem.

Google is your friend.

这篇关于OpenCV(C ++ / Qt) - cornerSubPix错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆