kyamagu / mexopencv

Collection and a development kit of matlab mex functions for OpenCV library
http://kyamagu.github.io/mexopencv
Other
661 stars 319 forks source link

make: ***[+cv/cvtColorTwoPlane.mexa64] Error 255 #423

Closed wildcat5566 closed 5 years ago

wildcat5566 commented 5 years ago

Hello,

I am currently running on following:

However, when I run:

$ make MATLABDIR=/my/matlab/directory (correctly specified)

I get the following error:

/path/to/mexopencv/src/+cv/cvtColorTwoPlane.cpp:50:44:
error: 'cvtColorTwoPlane' was not declared in this scope
    cv2ColorTwoPlane(ysrc, uvsrc, dst, code);
                                                                  ^

Makefile:170: recipe for target '+cv/cvtColorTwoPlane.mexa64' failed
make: ***[+cv/cvtColorTwoPlane.mexa64] Error 255

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!

amroamroamro commented 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:

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

wildcat5566 commented 5 years ago

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!

amroamroamro commented 5 years ago

https://github.com/kyamagu/mexopencv/wiki/Installation-(Linux,-MATLAB,-OpenCV-3)

A few notes:

If you still get test failures, please post the full error.