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