Thursday, May 24, 2012

Getting OpenCV libraries loaded in Matlab for Linux Ubuntu with LD_LIBRARY_PATH issues

It turns out there is a bug on Ubuntu that for some reason doesn't let you change LD_LIBRARY_PATH the way it used to. This is very annoying and you can read more about this on this link
So there are a few things you can do about this. What seemed to me simple to do and worked was to follow what this thread suggested which is basically use LD_PRELOAD before calling matlab in this way:

LD_PRELOAD=/home/OpenCV-2.0.0/lib/libcv.so:/home/OpenCV-2.0.0/lib/libcxcore.so matlab

One thing that I had to do was to be a super user (sudo su) before doing all this because I also needed root access from matlab and also it didn't seem to load these libraries if you just do "sudo matlab"
This is not a long term solution but at lest can get you going. I hope this helps.