Invalid MEX-file libopencv_core.so.2.4: cannot open shared object file: No such file or directory

8 views (last 30 days)
Hi,
Sorry my question may be a little bit long because I need to explain the steps to get this error.
So I was trying to run this somewhat old (2014) matlab code here to calibrate the omnicam on a linux computer. You can get the download link from their site "Calibration code for Linux/Windows (including test images): libomnical.zip (50 MB)"
And following its readme, to install, you should first set up paths in init.m and run make.m under the /src folder. There I met several errors, some are the same in this solution, and the other complains not finding <opencv2/opencv.hpp>, so eventually I change the line in the make.m under /src/Mapping/Geometry_Model/Projection/Mex, from
mex('rodriguesMex.cpp',['-L',opts.opencv_lib_dir], '-lopencv_core', '-lopencv_imgproc', '-lopencv_highgui', '-lopencv_features2d', '-lopencv_calib3d')
to
mex('rodriguesMex.cpp',['-L',opts.opencv_lib_dir], ['-I"',opts.opencv_inc_dir,'"'],'-lopencv_core', '-lopencv_imgproc', '-lopencv_highgui', '-lopencv_features2d', '-lopencv_calib3d')
to add include directory.
Now I can successfully run the make.m under /src to install. And I'm going to run the calibration code, which is "omni_calibration.m" under /src/Calibration. However it returns with this error message:
Invalid MEX-file
'/media/kudo/toshiba_4T/omnicam/libomnical/LibOmniCal/src/Mapping/Geometry_Model/Projection/Mex/rodriguesMex.mexa64':
libopencv_core.so.2.4: cannot open shared object file: No such file or directory
and I have no clue why it would happen since I thought properly installed it and this file "libopencv_core.so.2.4" is actually in my lib directory.
opts.opencv_lib_dir = '/home/kudo/anaconda3/pkgs/opencv-2.4.11-nppy27_0/lib';
opts.opencv_inc_dir = '/home/kudo/anaconda3/pkgs/opencv-2.4.11-nppy27_0/include';
and
(base) kudo@alien:~/anaconda3/pkgs/opencv-2.4.11-nppy27_0/lib/opencv2$ locate libopencv_core.so.2.4
/home/kudo/anaconda3/pkgs/opencv-2.4.11-nppy27_0/lib/libopencv_core.so.2.4
/home/kudo/anaconda3/pkgs/opencv-2.4.11-nppy27_0/lib/libopencv_core.so.2.4.11
Please help since this is a reletaively old code and may not be maintained anymore.
Thanks in advance!
  1 Comment
Walter Roberson
Walter Roberson on 1 Jul 2021
Could you verify that your two libopencv_core_so.2.4* files are real files? Or at least that if the .2.4 file is a link that it points to someplace that exists or is a hard-link to the .11 file ?

Sign in to comment.

Accepted Answer

Yongjian Feng
Yongjian Feng on 1 Jul 2021
Two things to try.
  1. On linux, ldd is a very useful tool. Try ldd rodriguesMex.mexa64. This will tell you if all the symbols can be resolved
  2. Your opts.opencv_lib_dir = '/home/kudo/anaconda3/pkgs/opencv-2.4.11-nppy27_0/lib'; is only used for linking the mex64, but might not be used for running it. You might need to set the LD_LIBRARY_PATH env var to point to this lib dir as well.
Thanks,
Yongjian
  3 Comments

Sign in to comment.

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Tags

Products


Release

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!