未定义对'的引用;不失真点';在opencv4android中

未定义对'的引用;不失真点';在opencv4android中,android,opencv,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

我当时正在使用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库。

在新版本中,我是否仍然遗漏了某些内容或某些错误?

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

可能有多种原因:

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

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


非常感谢你。看起来OpenCV4Android2.4.2在API和库的组织上都发生了很大的变化。后来出现了更多错误,所以我直接将版本改回2.3.1,一切正常~不客气。这让我想起了使用ffmpeg pre0.4.9的opencv 1.0之前的日子,在那里对视频库的每一次调整都打破了上层库中的一些依赖性。OpenCV的问题仍然是使用它的人太多,而对代码库贡献的人太少:)
cd /PATH_TO_YOUR_OPENCV_LIBS_INSTALL
nm libopencv_calib3d.so (find out which library is supposed to have the signature)