gpt4 book ai didi

c++ - OpenCV (C++/Qt) - cornerSubPix 错误

转载 作者:太空狗 更新时间:2023-10-29 23:15:21 27 4
gpt4 key购买 nike

您好!

我在使用 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>
#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);

}

}

这是我的 *.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

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

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

几天以来我一直在寻找答案,但我已经被屏蔽了。提前感谢大家的任何线索!

最佳答案

我上次使用相同的配置(Mac OS 10.10.3、Qt 5.4.1、OpenCV 3.0)遇到了同样的问题。编译器 clang 似乎与 opencv 3.0 不兼容。

使用旧版本的opencv(例如2.4.10)可能会解决问题。

玩得开心,祝你好运:)

关于c++ - OpenCV (C++/Qt) - cornerSubPix 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29650527/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com