Closed wildcat5566 closed 5 years ago
To quote the readme file:
The current version of mexopencv is compatible with OpenCV 3.4.1.
For previous OpenCV 3.x versions, checkout the corresponding tags:
- v3.4.0
- ...
Since you're running OpenCV 3.4.0, you need to use the corresponding mexopencv version https://github.com/kyamagu/mexopencv/releases/tag/v3.4.0
Dear @amroamroamro :
Hmm I figured out that my maketool was looking in the wrong directory when looking for opencv. I had an OpenCV 3.4.1 version installed under my user account (rather than the one in another version which was installed by root) and should have specified it correctly.
Here are how I tackled my problems and would like to share them with guys with similar issues:
<--Install OpenCV from source in non-default directory-->
$ (wget opencv and opencv_contrib from source, unzip)
$ cd /path/to/opencv
$ mkdir build && cd build
$ cmake -D CMAKE_BUILD_TYPE=Release \
-D CMAKE_INSTALL_PREFIX=/path/to/opencv \
-D OPENCV_EXTRA_MODULES_PATH=/path/to/opencv_contrib/modules ..
$ make -j4
$ make install
$ export PKG_CONFIG_PATH=/path/to/opencv/lib/pkgconfig
(Specify the path to be searched for the opencv installation.)
<--Build mexopencv--> (I am using non-default matlab directory)
$ cd /path/to/mexopencv
$ make MATLABDIR=/path/to/matlab
$ make all contrib MATLABDIR=/path/to/matlab
Both make and make all finished with some message like "MEX successfully finished" and finally returned no errors, so I think it did succeed. (However make test seems to stuck at item number 512/1189, for twice)
Thank you for your help!
https://github.com/kyamagu/mexopencv/wiki/Installation-(Linux,-MATLAB,-OpenCV-3)
A few notes:
dont run make
then make all contrib
, the first one implies no contrib modules, the second does. You cant do both in the same build (you're building different libMxArray libraries).
You should run make clean
whenever you change the "contrib" setting, otherwise you could get linking errors. In your case just run make all contrib
from the beginning.
since you're installing opencv locally, you should be setting LD_LIBRARY_PATH
before running MATLAB (this is the local-equivalent to adding libs-dir to /etc/ld.so.conf
which obviously needs root privileges). Otherwise, it is going to load the system-wide opencv libs v3.4.0 as opposed to your locally installed version v3.4.1
You can verify by running ldd
on one of the MEX-files inside MATLAB:
!ldd +cv/blur.mexa64
If you still get test failures, please post the full error.
Hello,
I am currently running on following:
However, when I run:
I get the following error:
I have no idea where did this came from. I wonder if it's the compiler's issue, since the default seems to be gcc instead of g++ My gcc compiler (5.4.0) seems to be out of date and incompatible, but however I am running on a public machine so I might not be able to update that.
Thank you for your help!