3

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 !

nigui
  • 31
  • 2
  • Is the compiler you use for your Qt-project the same that was used to compile OpenCV? Since your using Mac, it could also be a problem related different versions of the standard library being used (`libstdc++` vs. `libc++`). – nils Apr 15 '15 at 14:07
  • Thank you for you answer, what do you propose ? about libstdc++ and libc++ ? And to compile OpenCV I used the cmake and how do I know which compiler is used in Qt ? I think it's either GCC or Clang. – nigui Apr 16 '15 at 10:41

2 Answers2

0

I had the same problem last time with the same configurations (Mac OS 10.10.3, Qt 5.4.1, OpenCV 3.0). It seems like the compiler clang is not compatible for opencv 3.0.

Using the older version of opencv (for example 2.4.10) may solve the problem.

Have fun and good luck :)

Shirui Ma
  • 33
  • 1
  • 4
0

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.

Community
  • 1
  • 1
karlphillip
  • 92,053
  • 36
  • 243
  • 426