未定义的引用opencv4android中的'cvUndistortPoints'

时间:2012-10-11 13:29:48

标签: android opencv

我正在使用opencv4android(NDK)库进行移动项目。 该代码适用于2.3.1版。 在我将库更新到版本2.4.2之后,我遇到了一些由此行引起的意外错误:

projectPoints( (cv::Mat)obj_cube, rvec, tvec, K, Z, scene_cube );

错误信息:

jni/libs/libopencv_calib3d.a(calibration.cpp.o): In function `icvGetRectangles(CvMat const*, CvMat const*, CvMat const*, CvMat const*, CvSize, cv::Rect_<float>&, cv::Rect_<float>&)':
calibration.cpp:(.text._ZL16icvGetRectanglesPK5CvMatS1_S1_S1_6CvSizeRN2cv5Rect_IfEES6_+0x11c): undefined reference to `cvUndistortPoints'
make[1]: Leaving directory `/Users/huidong/Documents/workspace/com.qualcomm.fastcorner.SplashScreen'
jni/libs/libopencv_calib3d.a(calibration.cpp.o): In function `cvStereoRectify':
calibration.cpp:(.text.cvStereoRectify+0x59e): undefined reference to `cvUndistortPoints'
jni/libs/libopencv_calib3d.a(calibration.cpp.o): In function `cv::rectify3Collinear(cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::Size_<int>, cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::_OutputArray const&, cv::_OutputArray const&, cv::_OutputArray const&, cv::_OutputArray const&, cv::_OutputArray const&, cv::_OutputArray const&, cv::_OutputArray const&, double, cv::Size_<int>, cv::Rect_<int>*, cv::Rect_<int>*, int)':
calibration.cpp:(.text._ZN2cv17rectify3CollinearERKNS_11_InputArrayES2_S2_S2_S2_S2_S2_S2_NS_5Size_IiEES2_S2_S2_S2_RKNS_12_OutputArrayES7_S7_S7_S7_S7_S7_dS4_PNS_5Rect_IiEESA_i+0xda2): undefined reference to `cv::undistortPoints(cv::_InputArray const&, cv::_OutputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&)'
calibration.cpp:(.text._ZN2cv17rectify3CollinearERKNS_11_InputArrayES2_S2_S2_S2_S2_S2_S2_NS_5Size_IiEES2_S2_S2_S2_RKNS_12_OutputArrayES7_S7_S7_S7_S7_S7_dS4_PNS_5Rect_IiEESA_i+0xe2a): undefined reference to `cv::undistortPoints(cv::_InputArray const&, cv::_OutputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&)'
jni/libs/libopencv_calib3d.a(calibration.cpp.o): In function `cvFindExtrinsicCameraParams2':
calibration.cpp:(.text.cvFindExtrinsicCameraParams2+0x89e): undefined reference to `cvUndistortPoints'
collect2: ld returned 1 exit status
make[1]: [obj/local/armeabi-v7a/libfastcvsample.so] Error 1
make: [all] Error 2

主要问题是:

calibration.cpp: undefined reference to 'cvUndistortPoints'

如果我评论projectPoints函数,错误将消失。我添加了所有的opencv库 我是否仍然遗漏了新版本中的某些内容或一些错误?

1 个答案:

答案 0 :(得分:0)

缺少cvUndistortPoints的方法签名。更新肯定打破了你的依赖。

可能有多种原因:

  • 该方法已重命名(不太可能)
  • 方法签名已更改(可能)以添加新功能(在这种情况下,您需要等待另一次更新,因为该方法是另一种方法的引用)
  • 包含该方法的共享库(可能)已移动并且您正在链接不包含该方法的库(您是否真的添加了所有库?)

检查方法签名:

 cv::undistortPoints(cv::_InputArray const&, cv::_OutputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&)

仍然存在,通过查看参考文档(在您的更新的存档/ doc中)或偷看应该包含它的库(在unix上,例如在潜在的候选库上使用nm工具):

cd /PATH_TO_YOUR_OPENCV_LIBS_INSTALL
nm libopencv_calib3d.so (find out which library is supposed to have the signature)