我正在使用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库 我是否仍然遗漏了新版本中的某些内容或一些错误?
答案 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)