代码问题【LDES//AAAI2019】

paper:Li Y, Zhu J, Hoi S C H, et al. Robust Estimation of Similarity Transformation for Visual Object Tracking[C]. //AAAI2019.

 

代码跑不通,大段错误提示:

/utility/mexfiles/mpolar.mexa64' 无效

按照项目主页https://github.com/ihpdep/LDES上的建议

If it does not run directly, probably you need to compile the mex files by yourself. Please check the compile.m in ./utility/mexfiles and change the opencv path for your settings. We tested it with opencv 2.4 and 3.4

  重新编译utility目录下的文件

终端键入

pkg-config --cflags opencv

pkg-config --libs opencv

  找到opencv的lib和头文件的路径,然后修改compile.m如下:

mex -lopencv_core -lopencv_imgproc -L/usr/lib/x86_64-linux-gnu -I/usr/include/ mexResize.cpp MxArray.cpp
mex -lopencv_core -lopencv_imgproc -L/usr/lib/x86_64-linux-gnu -I/usr/include/opecnv mpolar.cpp
mex -lopencv_core -lopencv_imgproc -L/usr/lib/x86_64-linux-gnu ...
    -I/usr/include/ getColorSpace.cpp
mex -lopencv_core -lopencv_imgproc -L/usr/lib/x86_64-linux-gnu ...
    -I/usr/include/ getColorSpaceHist.cpp

  这里lib的目录和头文件的目录是根据上面终端查到的路径修改。然后编译。会提示

mpolar.cpp:51:9: error: ‘logPolar’ is not a member of ‘cv’

找到mpolar.cpp51行左右,上面写到

 if (CV_MAJOR_VERSION <3)
    {
        IplImage ipl_a = imgA, ipl_pa = pa;
        cvLogPolar(&ipl_a, &ipl_pa, cvPoint2D32f(imgA.cols >> 1, imgA.rows >> 1), mag);
    }
    else
    {
         cv::logPolar(imgA, pa, cv::Point2f( (float)colsA /2 , (float) rowsA /2), mag,cv::INTER_LINEAR+cv::WARP_FILL_OUTLIERS);
    }

  我的opencv版本是2.4.9 不支持cv::logPolar,只支持cvLogPolar.代码中也提示了如果版本小于3,如何如何

将else里面的cv:logPolar...注释掉

编译,正常通过。

 

运行程序,还是同样大段报错:

mpolar.mexa64' 无效:
缺少 '/usr/lib/x86_64-linux-gnu/libopencv_core.so.2.4->

在matlab中输入  !ldd mpolar.mexa64

提示:

./mpolar.mexa64: /usr/local/MATLAB/R2017b/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/x86_64-linux-gnu/libopencv_core.so.2.4)
./mpolar.mexa64: /usr/local/MATLAB/R2017b/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/lib/x86_64-linux-gnu/libopencv_imgproc.so.2.4)

按照这个帖子去修改https://blog.csdn.net/arackethis/article/details/42365573

注意MATLAB的路径 和GLIBCXX的版本号。

 

然后再跑程序。上面的错误消失,提示新的错误

/mpolar.mexa64' 无效:
/usr/local/MATLAB/R2017b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by
/usr/lib/x86_64-linux-gnu/libopencv_core.so.2.4)。

 

这个帖子中有解决办法:https://stackoverflow.com/questions/37921139/error-version-glibcxx-3-4-21-not-found

不要直接在终端启动matlab,这样:

root@qian-desktop:/usr/local/MATLAB/R2017b/bin# LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6 matlab

所以上面的修改matlab里面的libstdc++.so.6这一步应该并不需要。因为最后用了/usr/lib/x86_64-linux-gnu/目录下的libstdc++.so.6

2019.5.31

posted on 2019-05-31 03:47  博闻强记2010  阅读(983)  评论(1编辑  收藏  举报

导航