解决的办法是——绕过去,不要用这个库:
使用中发现如下代码抛出异常:
//vpTemplateTracker.cpp try { initHessienDesired(I); ptTemplateSuppPyr[0] = ptTemplateSupp; ptTemplateCompoPyr[0] = ptTemplateCompo; HdesirePyr[0] = Hdesire; HLMdesirePyr[0] = HLMdesire; HLMdesireInversePyr[0] = HLMdesireInverse; } catch (const vpException &e) { ptTemplateSuppPyr[0] = ptTemplateSupp; ptTemplateCompoPyr[0] = ptTemplateCompo; HdesirePyr[0] = Hdesire; HLMdesirePyr[0] = HLMdesire; HLMdesireInversePyr[0] = HLMdesireInverse; throw(e); }
调用栈是:
#5 0x00007ffff7b33b93 in __cxa_throw () from /lib64/libstdc++.so.6 #6 0x0000000000416b80 in vpTemplateTracker::initHessienDesiredPyr (this=0x7fffffffd470, I=...) at /data/ahfu/visp/modules/tracker/tt/src/vpTemplateTracker.cpp:756 #7 0x0000000000416603 in vpTemplateTracker::initFromPoints (this=0x7fffffffd470, I=..., v_ip=..., delaunay=false) at /data/ahfu/visp/modules/tracker/tt/src/vpTemplateTracker.cpp:704 #8 0x0000000000406a47 in main (argc=1, argv=0x7fffffffe358) at test.cpp:148
不太清楚究竟为何抛异常,于是注释掉try catch,重新编译链接执行。
看到了如下异常信息:
#5 0x00007ffff7b33b93 in __cxa_throw () from /lib64/libstdc++.so.6 #6 0x00000000004519b9 in vpMatrix::inverseByLULapack (this=0x7fffffffc390) at /data/ahfu/visp/modules/core/src/math/matrix/vpMatrix_lu.cpp:385 #7 0x00000000004514ff in vpMatrix::inverseByLU (this=0x7fffffffc390) at /data/ahfu/visp/modules/core/src/math/matrix/vpMatrix_lu.cpp:133 #8 0x000000000040d477 in vpTemplateTrackerSSDInverseCompositional::initCompInverse ( this=0x7fffffffd470) at /data/ahfu/visp/modules/tracker/tt/src/ssd/vpTemplateTrackerSSDInverseCompositional.cpp:79 #9 0x000000000040d7c3 in vpTemplateTrackerSSDInverseCompositional::initHessienDesired ( this=0x7fffffffd470, I=...) at /data/ahfu/visp/modules/tracker/tt/src/ssd/vpTemplateTrackerSSDInverseCompositional.cpp:103 #10 0x00000000004167b1 in vpTemplateTracker::initHessienDesiredPyr (this=0x7fffffffd470, I=...) at /data/ahfu/visp/modules/tracker/tt/src/vpTemplateTracker.cpp:744 #11 0x0000000000416603 in vpTemplateTracker::initFromPoints (this=0x7fffffffd470, I=..., v_ip=..., delaunay=false) at /data/ahfu/visp/modules/tracker/tt/src/vpTemplateTracker.cpp:704 #12 0x0000000000406a47 in main (argc=1, argv=0x7fffffffe358) at test.cpp:148
更换了最新的lapack库,仍然无法解决。
查看visp/modules/core/src/math/matrix/vpMatrix_lu.cpp 发现了这样的注释:
111 std::cout << "Inverse by LU "; 112 #if defined(VISP_HAVE_LAPACK) 113 std::cout << "(using Lapack)"; 114 #elif defined(VISP_HAVE_EIGEN3) 115 std::cout << "(using Eigen3)"; 116 #elif (VISP_HAVE_OPENCV_VERSION >= 0x020101) 117 std::cout << "(using OpenCV)"; 118 #elif defined (VISP_HAVE_GSL) 119 std::cout << "(using GSL)"; 120 #endif
说明编译选项可以选择不同的库。
于是:
cd /data/ahfu/visp/
mkdir build
cd build
ccmake .. #在界面中把 WITH_LAPACK设置为OFF
cmake ..
make -j
make install
重新编译测试程序运行,一切正常。